beliefer opened a new pull request, #37915: URL: https://github.com/apache/spark/pull/37915
### What changes were proposed in this pull request? Currently, Spark `Decimal` use the `java.math.BigDecimal` as the underlying implementation. As we know, the computing and storage efficiency of Spark `Decimal` is very low. This PR let `Decimal` can supports other underlying implementation. The reconstruction design of Spark `Decimal` is mainly based on the proxy mode - that is, to create the abstraction class `DecimalOperation`, to lower the current implementation of Spark `Decimal` based on `java.math.BigDecimal` to `JDKDecimalOperation`. The API of Spark `Decimal` remains unchanged and proxies the corresponding interface methods of `DecimalOperation`. The whole design is shown in the figure below. ![UML 图](https://user-images.githubusercontent.com/8486025/190606990-19252d1b-8f9f-49e1-8244-408b02e77e73.jpg) Whether Spark `Decimal` will proxy `JDKDecimalOperation` or other subclasses of `DecimalOperation` depends on the configuration parameter `spark.sql.decimal.implementation`. The default value of `spark.sql.decimal.implementation` is `JDKBigDecimal`, that is, `Decimal` will proxy `JDKDecimalOperation`. `spark.sql.decimal.implementation` can also be set as other possible optimization implementations. ### Why are the changes needed? Refactor `Decimal` so as we can use other underlying implementation. ### Does this PR introduce _any_ user-facing change? 'No'. The interface of `Decimal` is not changed. ### How was this patch tested? N/A -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org