Skip to content

[CALCITE-6787] Simplification process fails to remove the 'is not null' predicate - #5435

Open
xuzifu666 wants to merge 1 commit into
apache:mainfrom
xuzifu666:calcite-6787
Open

xuzifu666 wants to merge 1 commit into
apache:mainfrom
xuzifu666:calcite-6787

Conversation

@xuzifu666

Copy link
Copy Markdown
Member

@sonarqubecloud

Copy link
Copy Markdown

@shihchengwei-lab

Copy link
Copy Markdown

With $0 = NULL, expandSearch changes the result of NOT(nullAsFalseSearch) from TRUE to NULL, so a filter drops a row it previously kept.

I reproduced this at 85f38af by wrapping nullAsFalseSearch from testExpandSearchUnknownAs in NOT and calling expandSearch(rexBuilder, null, original, -1, RexUnknownAs.FALSE). RexInterpreter returned:

Before: NOT(SEARCH($0, Sarg[[0..100]; NULL AS FALSE])) => TRUE
After:  NOT(AND(>=($0, 0), <=($0, 100)))              => NULL

Could the shuttle preserve the inner SEARCH’s null behavior when it descends through NOT?

I used AI to help trace the change and run this API-level test. I didn’t test the Hive SQL path.

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.

2 participants