[SQL] Advance Calcite; implement MAP_KEYS#4962
Merged
mihaibudiu merged 2 commits intomainfrom Oct 24, 2025
Merged
Conversation
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR advances the Apache Calcite version to 1.41.0 and implements the MAP_KEYS SQL function. The Calcite update fixes two regression issues related to ROW type comparisons (#4890, #4891).
Key changes:
- Updates Calcite commit hash to version 1.41.0
- Implements
MAP_KEYSfunction to extract map keys as a sorted array - Adds validation to prevent NULL types as map keys
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
sql-to-dbsp-compiler/calcite_version.env |
Updates Calcite commit hash to newer version |
sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression1Tests.java |
Adds regression tests for issues #4890 and #4891 |
sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/MapTests.java |
Adds tests for MAP_KEYS function and NULL key validation |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/frontend/calciteCompiler/SqlToRelCompiler.java |
Adds emptyStatement() method for handling empty SQL statements |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/frontend/calciteCompiler/CalciteFunctions.java |
Registers MAP_KEYS function in the function catalog |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/frontend/TypeCompiler.java |
Adds NULL key type validation for maps |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/frontend/ExpressionCompiler.java |
Implements MAP_KEYS expression compilation |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/backend/rust/ToRustInnerVisitor.java |
Adds generic type parameters to cast_to_map function calls |
sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/DBSPCompiler.java |
Calls emptyStatement() for empty SQL statements |
docs.feldera.com/docs/sql/map.md |
Documents MAP_KEYS function usage |
docs.feldera.com/docs/sql/function-index.md |
Adds MAP_KEYS to function index |
crates/sqllib/src/map.rs |
Implements Rust functions for MAP_KEYS operation |
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
ryzhyk
approved these changes
Oct 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4890
Fixes #4891
In a separate commit it implements the
MAP_KEYSfunction.