adriangb commented on code in PR #20065:
URL: https://github.com/apache/datafusion/pull/20065#discussion_r2743342110


##########
datafusion/sqllogictest/test_files/aggregate.slt:
##########
@@ -7983,8 +7985,9 @@ logical_plan
 02)--Aggregate: groupBy=[[]], aggr=[[count(Int64(1))]]
 03)----TableScan: t projection=[]
 physical_plan
-01)ProjectionExec: expr=[2 as count(), 2 as count(*)]
-02)--PlaceholderRowExec
+01)ProjectionExec: expr=[count(Int64(1))@0 as count(), count(Int64(1))@0 as 
count(*)]
+02)--ProjectionExec: expr=[2 as count(Int64(1))]
+03)----PlaceholderRowExec

Review Comment:
   This is also an improvement.
   
   Previously we would brodcast the literal `2` to the number of rows twice (`2 
as count(), 2 as count(*)` -> `lit(2), lit(2)`. Now we first expand it once in 
an inner projection then reference that column with aliases twice (i.e. clone 
the pointer to the array).
   
   In this case it's 1 row so it's not really meaningful, but is nonetheless 
better. I'll see if I can craft an example that shows this behavior with N rows.



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