Github user travishegner commented on the pull request:
https://github.com/apache/spark/pull/8780#issuecomment-142282068
I'm making sure the new version builds, but here are the rules:
```scala
private[sql] def bounded(precision: Int, scale: Int): DecimalType = {
if (precision <= 0)
DecimalType.SYSTEM_DEFAULT
else if (scale > precision)
DecimalType(min(precision, MAX_PRECISION), min(precision, MAX_SCALE))
else
DecimalType(min(precision, MAX_PRECISION), min(scale, MAX_SCALE))
}
```
For both Decimal and Numeric types in `JDBCRDD.scala`, it now will call the
`DecimalType.bounded()` regardless the values of `precision` and `scale`. This
allows all of the validity checks to happen inside of that function. The rules
above are simply if precision is invalid, return a `SYSTEM_DEFAULT`. if `scale
> precision` then force `scale = precision`. And all else retains previous
behavior.
Once I verify that it builds and runs, I will update the pull request. Does
this look accurate?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]