cloud-fan commented on code in PR #49202:
URL: https://github.com/apache/spark/pull/49202#discussion_r1897214681


##########
sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q21.sf100/explain.txt:
##########
@@ -131,38 +133,46 @@ Functions [2]: [sum(CASE WHEN (d_date#10 < 2000-03-11) 
THEN inv_quantity_on_hand
 Aggregate Attributes [2]: [sum(CASE WHEN (d_date#10 < 2000-03-11) THEN 
inv_quantity_on_hand#3 ELSE 0 END)#17, sum(CASE WHEN (d_date#10 >= 2000-03-11) 
THEN inv_quantity_on_hand#3 ELSE 0 END)#18]
 Results [4]: [w_warehouse_name#12, i_item_id#7, sum(CASE WHEN (d_date#10 < 
2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)#17 AS inv_before#19, 
sum(CASE WHEN (d_date#10 >= 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 
END)#18 AS inv_after#20]
 
-(23) Filter [codegen id : 5]
+(23) Project [codegen id : 5]
+Output [5]: [w_warehouse_name#12, i_item_id#7, inv_before#19, inv_after#20, 
CASE WHEN (inv_before#19 > 0) THEN (cast(inv_after#20 as double) / 
cast(inv_before#19 as double)) END AS _common_expr_0#21]
 Input [4]: [w_warehouse_name#12, i_item_id#7, inv_before#19, inv_after#20]
-Condition : (CASE WHEN (inv_before#19 > 0) THEN ((cast(inv_after#20 as double) 
/ cast(inv_before#19 as double)) >= 0.666667) END AND CASE WHEN (inv_before#19 
> 0) THEN ((cast(inv_after#20 as double) / cast(inv_before#19 as double)) <= 
1.5) END)

Review Comment:
   ah so this is a positive plan change that we avoid computing the CASE WHEN 
multiple times in the Filter.



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