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


##########
datafusion/core/tests/sqllogictests/test_files/tpch.slt:
##########
@@ -118,14 +118,18 @@ CREATE EXTERNAL TABLE IF NOT EXISTS supplier (
 
 
 # q1
+# The decimal calculation `sum(l_extendedprice * (1 - l_discount) * (1 + 
l_tax)) as sum_charge` actually causes
+# overflow on decimal multiplication. Because the kernel DataFusion uses 
doesn't allow precision loss, we need
+# a cast to decimal(12,2) to avoid the overflow. We can get rid of it once we 
can use new multiply kernel from
+# arrow-rs which allows precision-loss.
 query TTRRRRRRRI
 select
     l_returnflag,
     l_linestatus,
     sum(l_quantity) as sum_qty,
     sum(l_extendedprice) as sum_base_price,
     sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
-    sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
+    sum(cast(l_extendedprice as decimal(12,2)) * (1 - l_discount) * (1 + 
l_tax)) as sum_charge,

Review Comment:
   See https://github.com/apache/arrow-datafusion/pull/5675/files#r1148798281



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