antonkw opened a new pull request, #4177:
URL: https://github.com/apache/calcite/pull/4177

   I don't expect that it can be merged as is.
   In the first order, I want to demonstrate the issue with anti joins: 
https://issues.apache.org/jira/browse/CALCITE-6804
   
   For any anti-join with input (left-side) more complex than single table 
scan, rex sub query can't be converted to SQL.
   Reason: Filter's node input is not considered as something that can be 
referenced (via alias) in condition.
   But anti-join is that exact case.
   
   Example of logical plan:
   ```
   LogicalProject(product_id=[$0])
     LogicalFilter(condition=[NOT(EXISTS({
   LogicalFilter(condition=[=($cor0.product_id, $1)])
     JdbcTableScan(table=[[foodmart, product]])
   }))], variablesSet=[[$cor0]])
       LogicalProject(product_id=[$1])
         LogicalJoin(condition=[=($1, $16)], joinType=[left])
           JdbcTableScan(table=[[foodmart, product]])
           JdbcTableScan(table=[[foodmart, product]])
   ```
   `$cor0` should eventually refer to whole input aliased as `t`. 
   Without proposed change `$cor0` is being converted into  
`JdbcTableScan(table=[[foodmart, product]])`
   
   


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