You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And @tustvold notes For people looking to emulate spark which only supports precision up to 38, casting to Decimal256 and then truncating down to Decimal128 will be equivalent, and is what a precision loss arithmetic kernel would do
Describe the solution you'd like
If anyone needs spark compatible decimal division rules, I suggest:
Add a new config option
Apply the rewrite suggested by @tustvold (cast to Decimal256, divide, and then cast to Decimal128) as an AnalyzerRule
Describe alternatives you've considered
See ticket -- we discussed at length changing the semantics of division in arrow-rs and concluded there was no one agreed upon ideal behavior
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem or challenge?
As described in detail by @liukun4515 and @tustvold and @viirya on #6832, DataFusion's decimal devision semantics.
@liukun4515 notes #6832 (comment) that spark has the config to control the precision loss : https://github.com/apache/spark/blob/2be20e54a2222f6cdf64e8486d1910133b43665f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L246
And @tustvold notes For people looking to emulate spark which only supports precision up to 38, casting to Decimal256 and then truncating down to Decimal128 will be equivalent, and is what a precision loss arithmetic kernel would do
Describe the solution you'd like
If anyone needs spark compatible decimal division rules, I suggest:
Describe alternatives you've considered
See ticket -- we discussed at length changing the semantics of division in arrow-rs and concluded there was no one agreed upon ideal behavior
Additional context
No response
The text was updated successfully, but these errors were encountered: