viirya commented on code in PR #5675:
URL: https://github.com/apache/arrow-datafusion/pull/5675#discussion_r1152896889


##########
benchmarks/queries/q8.sql:
##########
@@ -1,9 +1,9 @@
 select
     o_year,
-    sum(case
+    cast(cast(sum(case
             when nation = 'BRAZIL' then volume
             else 0
-        end) / sum(volume) as mkt_share
+        end) as decimal(12,2)) / cast(sum(volume) as decimal(12,2)) as 
decimal(15,2)) as mkt_share

Review Comment:
   Current decimal divide kernel fails to compute this. The result decimal type 
is 38 scale. While `divide_dyn_opt_decimal` multiplies `left` array with 
`10.pow(scale)`, obviously it overflows because the multiply kernel doesn't 
allow precision-loss multiplication.



-- 
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]

Reply via email to