bwzheng2010 opened a new pull request, #4640: URL: https://github.com/apache/hive/pull/4640
HIVE-27553: Fix After upgrading from Hive1 to Hive3, Decimal computation experiences a loss of precision ### What changes were proposed in this pull request? I would like to introduce a configuration parameter, `hive.sql.decimalOperations.allowPrecisionLoss`, to effectively tackle this issue. By default, its value is set to `false`, thereby embracing the new behavior as described in HIVE-15331. Alternatively, if it is set to `true`, Hive will adhere to the previous rules, as elaborated in HIVE-27553. This solution takes its cues from Spark's methodology, as extensively outlined in the [Spark SQL Migration Guide ](https://spark.apache.org/docs/2.4.0/sql-migration-guide-upgrade.html#upgrading-from-spark-sql-22-to-23)for the transition from version 2.2 to 2.3 . ### Why are the changes needed? The purpose of resolving this issue is to assist those who intend to upgrade from Hive 1.0 to 3.0. They may encounter discrepancies in decimal computation behavior between versions. By means of this configuration, compatibility with the previous computation behavior can be ensured. ### Does this PR introduce _any_ user-facing change? When the `hive.sql.decimalOperations.allowPrecisionLoss` parameter is utilized with its default configuration, it does not have any user-facing implications. If this parameter is changed to `false`, This impact is : decimal computations will be performed using the computation methodology of Hive 1.0. ### Is the change a dependency upgrade? No ### How was this patch tested? `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPDivide#testDecimalDivisionResultTypeNotAllowLoss` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPMinus#testDecimalMinusResultType` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPMinus#testDecimalMinusResultTypeNotAllowLoss` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPMultiply#testDecimalMultiplyResultType` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPMultiply#testDecimalMultiplyResultTypeNotAllowLoss` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPPlus#testDecimalPlusResultType` `org.apache.hadoop.hive.ql.udf.generic.TestGenericUDFOPPlus#testDecimalPlusResultType` -- 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]
