[ https://issues.apache.org/jira/browse/IMPALA-7755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Rogers reassigned IMPALA-7755: ----------------------------------- Assignee: (was: Paul Rogers) Description: Testing revealed one issue and one limitation of the {{IS [NOT] DISTINCT FROM}} optimizations in {{SimplifyDistinctFromRule}}. The rule can simplify {{sum(id) <=> sum(id)}} to {{false}}. But, according to IMPALA-5125, the rewrite cannot be applied if it would remove the only aggregate. This is a bug. A simplification is missing: {{id IS DISTINCT FROM NULL}} → {{id IS NOT NULL}}. Here is a specific test case from {{FullRewriteTest}} create as part of IMPALA-7655: {code:sql} @Test public void TestSimplifyDistinctFromRule() throws ImpalaException { verifySelectRewrite("if(sum(int_col) <=> sum(int_col), 1, 2)", "CASE WHEN sum(int_col) IS NOT DISTINCT FROM sum(int_col) THEN 1 ELSE 2 END"); } {code} The above fails, the re-writer produces "2" because it ignores the "must preserve aggregate" rule. was: Testing revealed one issue and one limitation of the {{IS [NOT] DISTINCT FROM}} optimizations in {{SimplifyDistinctFromRule}}. The rule can simplify {{sum(id) <=> sum(id)}} to {{false}}. But, according to IMPALA-5125, the rewrite cannot be applied if it would remove the only aggregate. This is a bug. A simplification is missing: {{id IS DISTINCT FROM NULL}} → {{id IS NOT NULL}}. > IS [NOT] DISTINCT FROM rewrite rules don't handle aggregates > ------------------------------------------------------------ > > Key: IMPALA-7755 > URL: https://issues.apache.org/jira/browse/IMPALA-7755 > Project: IMPALA > Issue Type: Bug > Components: Frontend > Affects Versions: Impala 3.0 > Reporter: Paul Rogers > Priority: Minor > > Testing revealed one issue and one limitation of the {{IS [NOT] DISTINCT > FROM}} optimizations in {{SimplifyDistinctFromRule}}. > The rule can simplify {{sum(id) <=> sum(id)}} to {{false}}. But, according to > IMPALA-5125, the rewrite cannot be applied if it would remove the only > aggregate. This is a bug. > A simplification is missing: {{id IS DISTINCT FROM NULL}} → {{id IS NOT > NULL}}. > Here is a specific test case from {{FullRewriteTest}} create as part of > IMPALA-7655: > {code:sql} > @Test > public void TestSimplifyDistinctFromRule() throws ImpalaException { > verifySelectRewrite("if(sum(int_col) <=> sum(int_col), 1, 2)", > "CASE WHEN sum(int_col) IS NOT DISTINCT FROM sum(int_col) THEN 1 ELSE > 2 END"); > } > {code} > The above fails, the re-writer produces "2" because it ignores the "must > preserve aggregate" rule. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org