Skip to content

Expression index is used for filters on a different function of the same column, returning wrong results #20255

Description

@yihua

With an expression index on a function of a column, data skipping also uses that index for filters on a different function of the same column. Example: with create index idx on t using column_stats(city) options(expr='lower'), the query select * from t where upper(city) = 'CITY_4242' returns no rows (1,224 with hoodie.enable.data.skipping=false), and where length(city) = 9 fails with ClassCastException: String cannot be cast to Integer.

Cause: ExpressionIndexSupport.extractQueryAndLiterals unwraps any UnaryExpression over the index's source column without checking that it is the index's function. Proposal: match the filter's function against the index definition before using the index, and fall back to column stats otherwise.

Activity

  1. yihua commented on Oct 9, 2026

    @yihua
    ContributorAuthor

    Fixed by #20256.

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

    area:indexIndexing functionalityarea:query-engineQuery engine integrationspriority:highSignificant impact; potential bugstype:bugBug reports and fixes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions