[
https://issues.apache.org/jira/browse/CALCITE-3544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-3544:
------------------------------------
Labels: pull-request-available (was: )
> RexSimplify does not exploit all known predicates
> -------------------------------------------------
>
> Key: CALCITE-3544
> URL: https://issues.apache.org/jira/browse/CALCITE-3544
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.21.0
> Reporter: Chunwei Lei
> Assignee: Chunwei Lei
> Priority: Major
> Labels: pull-request-available
>
> When there are multiple predicates in RexSimplify, only the first predicates
> will be used to simplify the RexNode. The following test can reproduce.
> {code:java}
> // RexProgramTest.java
> @Test public void testSimplifyRangeWithMultiPredicates() {
> RelDataType type = typeFactory.createSqlType(SqlTypeName.INTEGER);
> final RexNode ref = input(type, 0);
> List<RexNode> predicates = new ArrayList<>();
> predicates.add(gt(ref, literal(1)));
> predicates.add(le(ref, literal(5)));
> RelOptPredicateList relOptPredicateList =
> RelOptPredicateList.of(rexBuilder, predicates);
> final RexSimplify simplify =
> new RexSimplify(rexBuilder, relOptPredicateList, RexUtil.EXECUTOR)
> .withParanoid(true);
> RexNode result = simplify.simplify(gt(ref, literal(9)));
> assertThat(result, is(falseLiteral));
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)