joooger opened a new pull request, #5343: URL: https://github.com/apache/calcite/pull/5343
## Jira Link [CALCITE-7867](https://issues.apache.org/jira/browse/CALCITE-7867) ## Changes Proposed `RexSimplify.residue` applied each `<>` predicate with `RangeSets.minus`, which copies the whole range set. `simplifyOrTerms` and `simplifyAndTerms` pass one predicate per preceding term, so simplifying `x = c1 OR ... OR x = cN` on a NOT NULL `x`, or `x <> c1 AND ... AND x <> cN` as a filter, took O(N^3) time: about 425 s and 475 s for N = 2,000. `residue` now narrows one mutable `TreeRangeSet` in place and returns an immutable copy, which makes both O(N^2 log N): about 1.4 s and 1.2 s for N = 2,000. The returned range set is the same as before. Tests: `RexProgramTest.testSimplifyLargeOrOfEqualitiesOnNotNullOperand` and `testSimplifyLargeAndOfNotEqualsAsFilter`. Without the fix each one times out after 5 minutes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
