Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation of SQL functions with labels #21691

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

findepi
Copy link
Member

@findepi findepi commented Apr 24, 2024

The labels are used for LEAVE, ITERATE inside LOOP, REPEAT or WHILE.
When generating function bytecode, the SqlRoutineCompiler relied on
identity of IrLabel objects, which is maintained by the
SqlRoutinePlanner. However, if the function IR is transferred to a
worker, the identity is lost which was resulting in function compilation
error. This commit fixes this by generating unique labels names in the
function planner and identifying IR labels by value in the function
compiler.

Fixes #21682

@cla-bot cla-bot bot added the cla-signed label Apr 24, 2024
@findepi findepi force-pushed the findepi/routines branch 2 times, most recently from cabccce to fb6db65 Compare April 24, 2024 16:42
@findepi findepi changed the title Fix SQL compilation of functions with labels Fix compilation of SQL functions with labels Apr 24, 2024
There are tests for WHILE and REPEAT, add one for LOOP.
@findepi
Copy link
Member Author

findepi commented Apr 24, 2024

findepi added 2 commits April 25, 2024 09:58
The labels are used for LEAVE, ITERATE inside LOOP, REPEAT or WHILE.
When generating function bytecode, the `SqlRoutineCompiler` relied on
identity of `IrLabel` objects, which is maintained by the
`SqlRoutinePlanner`. However, if the function IR is transferred to a
worker, the identity is lost which was resulting in function compilation
error. This commit fixes this by generating unique labels names in the
function planner and identifying IR labels by value in the function
compiler.
@findepi findepi merged commit 14920e8 into trinodb:master Apr 25, 2024
95 checks passed
@findepi findepi deleted the findepi/routines branch April 25, 2024 09:34
@github-actions github-actions bot added this to the 446 milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Function with LOOP fails with "Compiler failed [...] break target does not exist" when run on worker
3 participants