liukun4515 commented on issue #3557:
URL:
https://github.com/apache/arrow-datafusion/issues/3557#issuecomment-1258990555
I debug the test case, and find the reason.
In the type coercion, we don't handle the subquery expr and sub query plan.
Below this is log
```
2022-09-27T03:52:57Z TRACE datafusion_optimizer::optimizer] Full input
logical plan:
Sort: #customer.c_custkey ASC NULLS LAST
Projection: #customer.c_custkey
Filter: #customer.c_acctbal < (<subquery>)
Subquery:
Projection: #SUM(orders.o_totalprice)
Aggregate: groupBy=[[]], aggr=[[SUM(#orders.o_totalprice)]]
Filter: #orders.o_custkey = #customer.c_custkey AND
#orders.o_totalprice < (<subquery>)
Subquery:
Projection: #SUM(lineitem.l_extendedprice) AS price
Aggregate: groupBy=[[]],
aggr=[[SUM(#lineitem.l_extendedprice)]]
Filter: #lineitem.l_orderkey = #orders.o_orderkey
TableScan: lineitem
TableScan: orders
TableScan: customer
[2022-09-27T03:52:57Z DEBUG datafusion_optimizer::optimizer] After apply
type_coercion rule:
[2022-09-27T03:52:57Z DEBUG datafusion_optimizer::optimizer] Optimized
logical plan:
Sort: #customer.c_custkey ASC NULLS LAST
Projection: #customer.c_custkey
Filter: CAST(#customer.c_acctbal AS Decimal128(25, 2)) < (<subquery>)
Subquery:
Projection: #SUM(orders.o_totalprice)
Aggregate: groupBy=[[]], aggr=[[SUM(#orders.o_totalprice)]]
Filter: #orders.o_custkey = #customer.c_custkey AND
#orders.o_totalprice < (<subquery>)
Subquery:
Projection: #SUM(lineitem.l_extendedprice) AS price
Aggregate: groupBy=[[]],
aggr=[[SUM(#lineitem.l_extendedprice)]]
Filter: #lineitem.l_orderkey = #orders.o_orderkey
TableScan: lineitem
TableScan: orders
TableScan: customer
```
I think the rewrite could handle the sub query plan.
Do you have any comments for that? @andygrove I know you have implemented
the subquery.
--
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]