Skip to content

isthmus: a dotted identifier whose first component names a column fails with an internal IllegalStateException #1320

Description

@nielspardon

A dotted identifier whose first component matches a column name resolves that column through ParameterScope.resolveColumn, passes validation, and then fails inside Calcite with an internal IllegalStateException rather than a diagnosable error. A single table is enough:

new SqlExpressionToSubstrait().convert("A.A1", List.of("CREATE TABLE T (A BIGINT, A1 BIGINT)"));
// java.lang.IllegalStateException: Trying to access field A1 in a type with no fields: BIGINT

It is easier to hit by accident across tables — a table named A alongside a different table carrying a column named A:

new SqlExpressionToSubstrait().convert(
    "A.A1", List.of("CREATE TABLE A (A1 BIGINT, A2 BIGINT)", "CREATE TABLE B (A BIGINT)"));
// java.lang.IllegalStateException: Trying to access field A1 in a type with no fields: BIGINT

IsthmusExecutionExceptionHandler matches only SqlParseException and CalciteContextException message patterns, so from the CLI this escapes as an unrecognized internal error instead of one of the hints that handler exists to give. Since qualified references are not supported at all (#1319), a user who reaches for A.A1 to disambiguate gets Calcite internals with no pointer; a clear "qualified references are not supported" would be the useful outcome.

Measured on main at ade72bc.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingisthmus

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions