mingmwang commented on code in PR #6457:
URL: https://github.com/apache/arrow-datafusion/pull/6457#discussion_r1227892180
##########
datafusion/optimizer/src/scalar_subquery_to_join.rs:
##########
@@ -513,20 +584,17 @@ mod tests {
.build()?;
let expected = "Projection: customer.c_custkey [c_custkey:Int64]\
- \n Inner Join: customer.c_custkey = __scalar_sq_1.__value
[c_custkey:Int64, c_name:Utf8, __value:Int64;N]\
- \n TableScan: customer [c_custkey:Int64, c_name:Utf8]\
- \n SubqueryAlias: __scalar_sq_1 [__value:Int64;N]\
- \n Projection: MAX(orders.o_custkey) AS __value [__value:Int64;N]\
- \n Aggregate: groupBy=[[]], aggr=[[MAX(orders.o_custkey)]]
[MAX(orders.o_custkey):Int64;N]\
- \n Filter: orders.o_custkey = orders.o_custkey
[o_orderkey:Int64, o_custkey:Int64, o_orderstatus:Utf8, o_totalprice:Float64;N]\
- \n TableScan: orders [o_orderkey:Int64, o_custkey:Int64,
o_orderstatus:Utf8, o_totalprice:Float64;N]";
+ \n Filter: customer.c_custkey = __scalar_sq_1.MAX(orders.o_custkey)
[c_custkey:Int64, c_name:Utf8, MAX(orders.o_custkey):Int64;N]\
+ \n Left Join: [c_custkey:Int64, c_name:Utf8,
MAX(orders.o_custkey):Int64;N]\
Review Comment:
Yes. you are right. We can leverage other rules to further optimize the
plan.
And Optimizing the `Scalar Subquery` to `Left Join` is more general, no
matter the `Scalar Subquery` is in `Projection` exprs or in the `Filter` exprs.
--
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]