Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7605#discussion_r35348902
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DecimalType.scala ---
@@ -53,18 +53,20 @@ case class DecimalType(precisionInfo:
Option[PrecisionInfo]) extends FractionalT
private[sql] val ordering = Decimal.DecimalIsFractional
private[sql] val asIntegral = Decimal.DecimalAsIfIntegral
- def precision: Int = precisionInfo.map(_.precision).getOrElse(-1)
+ def precision: Int = precisionInfo.map(_.precision).getOrElse(10)
- def scale: Int = precisionInfo.map(_.scale).getOrElse(-1)
+ def scale: Int = precisionInfo.map(_.scale).getOrElse(0)
- override def typeName: String = precisionInfo match {
- case Some(PrecisionInfo(precision, scale)) =>
s"decimal($precision,$scale)"
- case None => "decimal"
- }
+ override def typeName: String = s"decimal($precision,$scale)"
+
+ override def toString: String = s"DecimalType($precision,$scale)"
- override def toString: String = precisionInfo match {
- case Some(PrecisionInfo(precision, scale)) =>
s"DecimalType($precision,$scale)"
- case None => "DecimalType()"
+ private[sql] def isWiderThan(other: DataType): Boolean = other match {
--- End diff --
also for something like this you should add a unit test
---
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]