[CALCITE-6242] Enhance lambda closure#4926
Conversation
…d" error when a column is used in lambda evaluation logic
| .type("RecordType(INTEGER NOT NULL EXPR$0) NOT NULL"); | ||
| s.withSql("select HIGHER_ORDER_FUNCTION2(1, () -> 0.1)") | ||
| .type("RecordType(INTEGER NOT NULL EXPR$0) NOT NULL"); | ||
| s.withSql("select HIGHER_ORDER_FUNCTION(1, (x, y) -> x + 1 + ^emp.deptno^) from emp") |
There was a problem hiding this comment.
Please add jira message in test.
|
|
||
| !ok | ||
|
|
||
| select * |
|
|
||
| @Override public R visitLambda(RexLambda lambda, P arg) { | ||
| return null; | ||
| if (!deep) { |
There was a problem hiding this comment.
I think you could add some comments here to explain the reason.
|
There are some new discussions in Jira that you should keep up with. |
…bda closure support Add a conformance option that allows SQL dialects to reject lambda closures (references to enclosing scope variables from within lambda expressions).
mihaibudiu
left a comment
There was a problem hiding this comment.
What happens to nested lambdas? Are they legal? Will they validate?
x -> (y -> x + y)
For the inner closure "x" should not be treated like a table column name.
|
Thank you for your suggestion. Currently, nested lambdas like x -> (y -> x + y) can be parsed normally. I have added more cases to verify @mihaibudiu |



jira: https://issues.apache.org/jira/browse/CALCITE-6242