Eugene-Mark commented on PR #36499: URL: https://github.com/apache/spark/pull/36499#issuecomment-1147065740
We have "maximum scale" [defined in Spark](https://github.com/apache/spark/blob/bab70b1ef24a2461395b32f609a9274269cb000e/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DecimalType.scala#L128), however, it's not suitable in our case. The current `MAX_SCALE` is `38` and is used in sth like boundary protecting in Decimal's [divide operator](https://github.com/apache/spark/blob/bab70b1ef24a2461395b32f609a9274269cb000e/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala#L138). We need to have a relatively universal decimal type ( Can cover almost "all" types of Number value), which I think current [SYSTEM_DEFAULT](https://github.com/apache/spark/blob/bab70b1ef24a2461395b32f609a9274269cb000e/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DecimalType.scala#L129) is right candidate upon the usage of it in `JavaTypeInference` and `ScalaReflection`, it's used as default type of Decimal/Number. `val SYSTEM_DEFAULT: DecimalType = DecimalType(MAX_PRECISION, 18)` I suggest we also modify the OracleDialects [default decimal](https://github.com/apache/spark/blob/cc0bf563b8caea21da5692f05e34b5f77e002ab9/sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala#L88). The `DecimalType(DecimalType.MAX_PRECISION, 10)` is more like a magic type since there is no clue about why the scale should be set to 10. For the sake of the consistency, maybe it's better to replaced it with `DecimalType.SYSTEM_DEFAULT`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
