Skip to content

Conversation

@mihaibudiu
Copy link
Contributor

Prior to this fix the compiler would crash with an assertion error:

error: Compiler error
some() applied to a nullable expression
org.dbsp.sqlCompiler.ir.expression.DBSPSomeExpression.<init>(DBSPSomeExpression.java:21)
org.dbsp.sqlCompiler.compiler.visitors.inner.ExpressionTranslator.postorder(ExpressionTranslator.java:404)

The reason for this is that both nullable and non-nullable strings are represented by nullable InternedString objects, so the nullability of the data changes. The fix is to avoid wrapping in Some any InternedString - they are already option values.

I have also changed a call to a Calcite API which has been modified and will no longer compile on newer versions of Calcite.

@mihaibudiu mihaibudiu requested review from Copilot and ryzhyk January 7, 2026 19:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a compiler crash when processing SQL queries involving interned strings, specifically addressing an assertion error where Some() was incorrectly applied to nullable InternedString expressions. The fix recognizes that interned strings are inherently nullable and should not be wrapped in Some. Additionally, the PR updates deprecated Calcite API calls to ensure compatibility with newer Calcite versions.

  • Added logic to prevent wrapping InternedString types in Some expressions since they are already option values
  • Refactored Calcite type system configuration to replace deprecated methods with getMaxPrecision and getMaxScale overrides
  • Added test case validating LEFT JOIN behavior with interned string columns

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
InternTests.java Adds new test case for LEFT JOIN operations with interned strings to validate the bug fix
InternInner.java Implements the core fix by overriding postorder for DBSPSomeExpression to skip wrapping interned types
SqlToRelCompiler.java Updates Calcite API usage by replacing deprecated numeric precision/scale methods with type-specific overrides

@mihaibudiu mihaibudiu enabled auto-merge January 7, 2026 19:27
@mihaibudiu mihaibudiu added this pull request to the merge queue Jan 7, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 7, 2026
@mihaibudiu mihaibudiu enabled auto-merge January 7, 2026 21:51
@mihaibudiu mihaibudiu added this pull request to the merge queue Jan 7, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 7, 2026
@mihaibudiu mihaibudiu added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit e0ea4cc Jan 7, 2026
1 check passed
@mihaibudiu mihaibudiu deleted the intern branch January 7, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants