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.
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 queryselect * from t where upper(city) = 'CITY_4242'returns no rows (1,224 withhoodie.enable.data.skipping=false), andwhere length(city) = 9fails withClassCastException: String cannot be cast to Integer.Cause:
ExpressionIndexSupport.extractQueryAndLiteralsunwraps anyUnaryExpressionover 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.