Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7605#discussion_r35282301
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DecimalType.scala ---
@@ -92,31 +94,47 @@ object DecimalType extends AbstractDataType {
override private[sql] def simpleString: String = "decimal"
- val Unlimited: DecimalType = DecimalType(None)
+ val Maximum: DecimalType = DecimalType(Some(PrecisionInfo(MAX_PRECISION,
18)))
+
+ val Default: DecimalType = DecimalType(Some(PrecisionInfo(10, 0)))
+
+ val Unlimited: DecimalType = Maximum // backward compatibility
private[sql] object Fixed {
def unapply(t: DecimalType): Option[(Int, Int)] =
- t.precisionInfo.map(p => (p.precision, p.scale))
+ t.precisionInfo.map(p => (p.precision, p.scale)).orElse(Some((10,
0)))
}
private[sql] object Expression {
def unapply(e: Expression): Option[(Int, Int)] = e.dataType match {
- case t: DecimalType => t.precisionInfo.map(p => (p.precision,
p.scale))
+ case t: DecimalType => t.precisionInfo.map(p => (p.precision,
p.scale)).orElse(Some((10, 0)))
case _ => None
}
}
- def apply(): DecimalType = Unlimited
+ def apply(): DecimalType = Default
--- End diff --
Can we remove this? Declaring a zero-arg apply method is pretty error prone.
---
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]