jackwener commented on PR #4767:
URL: 
https://github.com/apache/arrow-datafusion/pull/4767#issuecomment-1438301224

   @ygf11 In fact, `subquery alias` doesn't actually work, we can eliminate it, 
and I'm getting ready to do it.
   
   You shouldn't see `Optimized Logical Plan`, which have eliminated `subquery 
alias`.
   
   `subquery alias` exist both in `exist-subquery` (Existential Test subquery) 
and `in-subquery` (Quantified Comparision subquery)
   
   ```sql
   spark-sql> explain extended select * from hudi_test where uuid in (select 
uuid from hudi_test);
   
   == Analyzed Logical Plan ==
   _hoodie_commit_time: string, _hoodie_commit_seqno: string, 
_hoodie_record_key: string, _hoodie_partition_path: string, _hoodie_file_name: 
string, uuid: int, name: string, price: double
   Project [_hoodie_commit_time#37, _hoodie_commit_seqno#38, 
_hoodie_record_key#39, _hoodie_partition_path#40, _hoodie_file_name#41, 
uuid#42, name#43, price#44]
   +- Filter uuid#42 IN (list#93 [])
      :  +- Project [uuid#104]
      :     +- SubqueryAlias spark_catalog.default.hudi_test
      :        +- Relation 
default.hudi_test[_hoodie_commit_time#99,_hoodie_commit_seqno#100,_hoodie_record_key#101,_hoodie_partition_path#102,_hoodie_file_name#103,uuid#104,name#105,price#106]
 parquet
      +- SubqueryAlias spark_catalog.default.hudi_test
         +- Relation 
default.hudi_test[_hoodie_commit_time#37,_hoodie_commit_seqno#38,_hoodie_record_key#39,_hoodie_partition_path#40,_hoodie_file_name#41,uuid#42,name#43,price#44]
 parquet
   ```
   
   ```sql
   spark-sql> explain extended select * from hudi_test where exists (select 
uuid from hudi_test);
   
   == Analyzed Logical Plan ==
   _hoodie_commit_time: string, _hoodie_commit_seqno: string, 
_hoodie_record_key: string, _hoodie_partition_path: string, _hoodie_file_name: 
string, uuid: int, name: string, price: double
   Project [_hoodie_commit_time#37, _hoodie_commit_seqno#38, 
_hoodie_record_key#39, _hoodie_partition_path#40, _hoodie_file_name#41, 
uuid#42, name#43, price#44]
   +- Filter exists#107 []
      :  +- Project [uuid#118]
      :     +- SubqueryAlias spark_catalog.default.hudi_test
      :        +- Relation 
default.hudi_test[_hoodie_commit_time#113,_hoodie_commit_seqno#114,_hoodie_record_key#115,_hoodie_partition_path#116,_hoodie_file_name#117,uuid#118,name#119,price#120]
 parquet
      +- SubqueryAlias spark_catalog.default.hudi_test
         +- Relation 
default.hudi_test[_hoodie_commit_time#37,_hoodie_commit_seqno#38,_hoodie_record_key#39,_hoodie_partition_path#40,_hoodie_file_name#41,uuid#42,name#43,price#44]
 parquet
   ```


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

Reply via email to