pepijnve commented on code in PR #21739:
URL: https://github.com/apache/datafusion/pull/21739#discussion_r3189712104


##########
datafusion/sqllogictest/test_files/tpch/plans/q1.slt.part:
##########
@@ -50,9 +50,9 @@ physical_plan
 01)SortPreservingMergeExec: [l_returnflag@0 ASC NULLS LAST, l_linestatus@1 ASC 
NULLS LAST]
 02)--SortExec: expr=[l_returnflag@0 ASC NULLS LAST, l_linestatus@1 ASC NULLS 
LAST], preserve_partitioning=[true]
 03)----ProjectionExec: expr=[l_returnflag@0 as l_returnflag, l_linestatus@1 as 
l_linestatus, sum(lineitem.l_quantity)@2 as sum_qty, 
sum(lineitem.l_extendedprice)@3 as sum_base_price, sum(lineitem.l_extendedprice 
* Int64(1) - lineitem.l_discount)@4 as sum_disc_price, 
sum(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount * Int64(1) + 
lineitem.l_tax)@5 as sum_charge, avg(lineitem.l_quantity)@6 as avg_qty, 
avg(lineitem.l_extendedprice)@7 as avg_price, avg(lineitem.l_discount)@8 as 
avg_disc, count(Int64(1))@9 as count_order]
-04)------AggregateExec: mode=FinalPartitioned, gby=[l_returnflag@0 as 
l_returnflag, l_linestatus@1 as l_linestatus], aggr=[sum(lineitem.l_quantity), 
sum(lineitem.l_extendedprice), sum(lineitem.l_extendedprice * Int64(1) - 
lineitem.l_discount), sum(lineitem.l_extendedprice * Int64(1) - 
lineitem.l_discount * Int64(1) + lineitem.l_tax), avg(lineitem.l_quantity), 
avg(lineitem.l_extendedprice), avg(lineitem.l_discount), count(Int64(1))]
+04)------AggregateExec: mode=FinalPartitioned, gby=[l_returnflag@0 as 
l_returnflag, l_linestatus@1 as l_linestatus], aggr=[sum(lineitem.l_quantity), 
sum(lineitem.l_extendedprice), sum(__common_expr_1) as 
sum(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount), 
sum(__common_expr_1 * Some(1),20,0 + lineitem.l_tax) as 
sum(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount * Int64(1) + 
lineitem.l_tax), avg(lineitem.l_quantity), avg(lineitem.l_extendedprice), 
avg(lineitem.l_discount), count(Int64(1))]

Review Comment:
   In the current state of this MR the `__common_expr_1` part is certainly 
intentional. My argumentation above was that this exposes the fact that line 4 
is not actually executing `sum(lineitem.l_extendedprice * 1 - 
lineitem.l_discount)`, that's the logical view of things. Instead 
`sum(__common_expr_1)` is being computed and `__common_expr_1` is calculated in 
line 7. For the physical plan I don't think you would want to obscure this.
   
   The `Some(1)` bit is unfortunate indeed, but I think that's a separate 
issue. The physical explain output doesn't format literals as nicely as the 
logical plan output does.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to