Yu Xu created CALCITE-6887: ------------------------------ Summary: In should distinct values with ReduceExpressionRule Key: CALCITE-6887 URL: https://issues.apache.org/jira/browse/CALCITE-6887 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.38.0 Reporter: Yu Xu Assignee: Yu Xu Fix For: 1.40.0
@Test void testReduceExpressionsWithIn() { final String sql = "select deptno, sal " + "from emp " + "where deptno in (1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1) "; sql(sql).withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS) .check(); } before: LogicalProject(DEPTNO=[$7], SAL=[$5]) LogicalFilter(condition=[IN($7, { LogicalValues(tuples=[[\{ 1 }, \{ 1 }, \{ 2 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 1 }, \{ 3 }, \{ 1 }]]) })]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) after: LogicalProject(DEPTNO=[$7], SAL=[$5]) LogicalFilter(condition=[IN($7, { LogicalValues(tuples=[[\{ 1 }, \{ 2 }, \{ 3 }]]) })]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) -- This message was sent by Atlassian Jira (v8.20.10#820010)