Stamatis Zampetakis created CALCITE-6793: --------------------------------------------
Summary: Cannot simplify comparisons using pulled SARG predicates Key: CALCITE-6793 URL: https://issues.apache.org/jira/browse/CALCITE-6793 Project: Calcite Issue Type: Bug Affects Versions: 1.38.0 Reporter: Stamatis Zampetakis Assignee: Stamatis Zampetakis RexSimplify has some logic to [simplify comparison operations|https://github.com/apache/calcite/blob/3fce658c05aa88b44af8cbcfd0809a420896d62b/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1858] by exploiting pulled up predicates (predicates that we know that hold in the inputs). Let's assume that we have the comparison {{age > 25}} and we can also pull the {{age > 10 AND age < 20}} predicate from the input(s). Using the pulled up predicates we can simplify {{ age > 25 }} to {{false}}. The simplification above used to work in the past and stopped working sometime after introducing the SEARCH operator and SARGs (CALCITE-4173). Using SARGs, the {{age > 10 AND age < 20}} predicate is now represented as {{SEARCH(age, Sarg[(10..20)])}} but SEARCH/SARGs cannot be handled by the existing logic so they cannot be used to simplify comparisons. -- This message was sent by Atlassian Jira (v8.20.10#820010)