Skip to content

[CALCITE-6242] Enhance lambda closure#4926

Open
cjj2010 wants to merge 5 commits into
apache:mainfrom
cjj2010:CALCITE-6242
Open

[CALCITE-6242] Enhance lambda closure#4926
cjj2010 wants to merge 5 commits into
apache:mainfrom
cjj2010:CALCITE-6242

Conversation

@cjj2010
Copy link
Copy Markdown
Contributor

@cjj2010 cjj2010 commented May 8, 2026

Terran added 2 commits May 8, 2026 16:31
.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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add jira message in test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


!ok

select *
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here.


@Override public R visitLambda(RexLambda lambda, P arg) {
return null;
if (!deep) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could add some comments here to explain the reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks

@cjj2010 cjj2010 changed the title [CALCITE-6242] The "exists" library function throws a "param not found" error when a column is used in lambda evaluation logic. [CALCITE-6242] Enhance lambda closure parsing May 9, 2026
Copy link
Copy Markdown
Member

@xuzifu666 xuzifu666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xuzifu666
Copy link
Copy Markdown
Member

There are some new discussions in Jira that you should keep up with.

@xuzifu666 xuzifu666 added the discussion-in-jira There's open discussion in JIRA to be resolved before proceeding with the PR label May 11, 2026
…bda closure support

Add a conformance option that allows SQL dialects to reject lambda
closures (references to enclosing scope variables from within lambda
expressions).
@cjj2010 cjj2010 changed the title [CALCITE-6242] Enhance lambda closure parsing [CALCITE-6242] Enhance lambda closure May 12, 2026
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discussion-in-jira There's open discussion in JIRA to be resolved before proceeding with the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants