GeezerVison is showing github.com — [SQL] Compute using UTF-8 strings; support `STARTSWITH` and `ENDSWITH` by mihaibudiu · Pull Request #7729 · feldera/feldera
Conversation
mihaibudiu
commented
Oct 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There are 3 commits:
- first commit adds a new class
Utf8String which wraps a string literal coming from a SQL program. This prevents accidentally computing on such strings using Java functions, which use UTF-16.
- second commit hides string literals from Calcite, by wrapping a literal X into a function
NON_BMP_LITERAL(X), to prevent Calcite from doing any computations with it
- third commit solves the issue we started with, i.e., add two puny functions. Writing tests for these functions uncovered the need for the other two commits
Linked Issue
Fixes #7714
Checklist
- Unit tests added/updated
- Documentation updated
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Summary: the SQL compiler now stores string literals as UTF-8, string literals with non-BMP characters are hidden from Calcite's constant folding, and STARTSWITH/ENDSWITH are added for strings and binary values. The docs are updated and the tests are thorough.
What I ran
| Check |
Result |
cargo check --locked -p feldera-sqllib |
✅ |
./build.sh |
❌ the slt module no longer compiles (see inline comment) |
mvn test -Dtest=StringTests,CastTests,FunctionsTest#testStartsEndsWith+testPositionNullLiteral |
✅ 40/40 |
My own QA cases: non-BMP literal in a SQL UDF body, IN ('🐍','a') with GROUP BY '🐍', LIKE … ESCAPE with a non-BMP literal, CHAR padding/CASE with BMP vs non-BMP literals |
✅ the optimized and runtime results agree |
Gates
- bug, critical: the build is broken because the
slt module still uses the removed DBSPStringLiteral constructor. Please fix it before merge.
- missing, medium (commit quality): the first commit,
[SQL] Represent string literal values as UTF-8, rewrites how literals are represented and how casts are folded, but its body is only the sign-off. Please explain why the change is needed, for example that Java computes on UTF-16, which led to wrong constant folding.
Uncovered cases
- Only views go through
NonBmpLiterals, via sqlToRel. Column DEFAULT expressions, LATENESS, and SET values skip it. No test covers a non-BMP literal there, for example DEFAULT '🐍x' on a VARCHAR(1) column.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Such a literal is now wrapped in a call that Calcite cannot fold, typed
VARCHAR. A literal with an unpaired surrogate, such as U&'\D83D', is an
error. CHR is not folded by Calcite, since it can build such a character.
Signed-off-by: Mihai Budiu <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gz
gz approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|