andygrove commented on code in PR #14273:
URL: https://github.com/apache/datafusion/pull/14273#discussion_r1936007682


##########
datafusion/sqllogictest/test_files/tpch/plans/q6.slt.part:
##########
@@ -31,13 +31,13 @@ logical_plan
 01)Projection: sum(lineitem.l_extendedprice * lineitem.l_discount) AS revenue
 02)--Aggregate: groupBy=[[]], aggr=[[sum(lineitem.l_extendedprice * 
lineitem.l_discount)]]
 03)----Projection: lineitem.l_extendedprice, lineitem.l_discount
-04)------Filter: lineitem.l_shipdate >= Date32("1994-01-01") AND 
lineitem.l_shipdate < Date32("1995-01-01") AND lineitem.l_discount >= 
Decimal128(Some(5),15,2) AND lineitem.l_discount <= Decimal128(Some(7),15,2) 
AND lineitem.l_quantity < Decimal128(Some(2400),15,2)
-05)--------TableScan: lineitem projection=[l_quantity, l_extendedprice, 
l_discount, l_shipdate], partial_filters=[lineitem.l_shipdate >= 
Date32("1994-01-01"), lineitem.l_shipdate < Date32("1995-01-01"), 
lineitem.l_discount >= Decimal128(Some(5),15,2), lineitem.l_discount <= 
Decimal128(Some(7),15,2), lineitem.l_quantity < Decimal128(Some(2400),15,2)]
+04)------Filter: lineitem.l_shipdate >= Date32("1994-01-01") AND 
lineitem.l_shipdate < Date32("1995-01-01") AND CAST(lineitem.l_discount AS 
Float64) >= Float64(0.049999999999999996) AND CAST(lineitem.l_discount AS 
Float64) <= Float64(0.06999999999999999) AND lineitem.l_quantity < 
Decimal128(Some(2400),15,2)
+05)--------TableScan: lineitem projection=[l_quantity, l_extendedprice, 
l_discount, l_shipdate], partial_filters=[lineitem.l_shipdate >= 
Date32("1994-01-01"), lineitem.l_shipdate < Date32("1995-01-01"), 
CAST(lineitem.l_discount AS Float64) >= Float64(0.049999999999999996), 
CAST(lineitem.l_discount AS Float64) <= Float64(0.06999999999999999), 
lineitem.l_quantity < Decimal128(Some(2400),15,2)]
 physical_plan
 01)ProjectionExec: expr=[sum(lineitem.l_extendedprice * lineitem.l_discount)@0 
as revenue]
 02)--AggregateExec: mode=Final, gby=[], aggr=[sum(lineitem.l_extendedprice * 
lineitem.l_discount)]
 03)----CoalescePartitionsExec
 04)------AggregateExec: mode=Partial, gby=[], 
aggr=[sum(lineitem.l_extendedprice * lineitem.l_discount)]
 05)--------CoalesceBatchesExec: target_batch_size=8192
-06)----------FilterExec: l_shipdate@3 >= 1994-01-01 AND l_shipdate@3 < 
1995-01-01 AND l_discount@2 >= Some(5),15,2 AND l_discount@2 <= Some(7),15,2 
AND l_quantity@0 < Some(2400),15,2, projection=[l_extendedprice@1, l_discount@2]
+06)----------FilterExec: l_shipdate@3 >= 1994-01-01 AND l_shipdate@3 < 
1995-01-01 AND CAST(l_discount@2 AS Float64) >= 0.049999999999999996 AND 
CAST(l_discount@2 AS Float64) <= 0.06999999999999999 AND l_quantity@0 < 
Some(2400),15,2, projection=[l_extendedprice@1, l_discount@2]

Review Comment:
   This is incorrect. `l_decimal` is a decimal and the literals in the query 
are also decimals. There should not be a cast from an exact type to an 
approximate type here.
   
   ```sql
   and l_discount between 0.05 and 0.07
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to