sbroeder opened a new pull request, #5226: URL: https://github.com/apache/calcite/pull/5226
…teral, Sarg) when pointCount >= 2 RexSimplify.simplifySearch only evaluated a SEARCH(subject, Sarg) call against its Sarg when sarg.isPoints() && sarg.pointCount <= 1, with no check for whether the subject itself is a constant. A single-point Sarg with any subject folded correctly, and a multi-point Sarg with a column-reference subject simplified correctly elsewhere, but a literal subject compared against a multi-point Sarg (for example, SEARCH(5, Sarg[1, 2])) fell through every branch unevaluated instead of folding to a boolean constant. This can occur whenever a rule substitutes a literal for a column reference in a SEARCH condition, such as when FilterSetOpTransposeRule pushes a filter through a branch of a Union that projects a constant. ## Jira Link [CALCITE-7747](https://issues.apache.org/jira/browse/CALCITE-7747) ## Changes Proposed <!-- Fix simplifySearch so that when the search subject is itself a RexLiteral, the call is expanded via the existing RexUtil.expandSearch and the result is simplified recursively, regardless of point count. This matches the treatment already given to a single-point Sarg, but adds the recursive simplify() call needed to fold the expanded comparison tree down to a constant. --> -- 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]
