Victoria Markman created DRILL-3002: ---------------------------------------
Summary: Can't plan inequality queries when scalar subquery has an expression with at least one distinct aggregate Key: DRILL-3002 URL: https://issues.apache.org/jira/browse/DRILL-3002 Project: Apache Drill Issue Type: Bug Components: Query Planning & Optimization Affects Versions: 1.0.0 Reporter: Victoria Markman Assignee: Jinfeng Ni Fails with mix of of distinct/non distinct scalar aggregates on the same column: {code} 0: jdbc:drill:schema=dfs> select * from t1 where a1 > ( select count(a2) + count(distinct a2) from t2); Error: SYSTEM ERROR: This query cannot be planned possibly due to either a cartesian join or an inequality join [Error Id: 69c0feda-6284-4a76-b1f7-bbc43a099a20 on atsqa4-133.qa.lab:31010] (state=,code=0) {code} Works with two distinct aggregates in expression: {code} 0: jdbc:drill:schema=dfs> select * from t1 where a1 > ( select count(distinct a2) + count(distinct a2) from t2); +------------+------------+------------+ | a1 | b1 | c1 | +------------+------------+------------+ +------------+------------+------------+ No rows selected (0.226 seconds) {code} Fails with two distinct aggregates on different columns: {code} 0: jdbc:drill:schema=dfs> select * from t1 where a1 > ( select count(distinct a2) + count(distinct b2) from t2); Error: SYSTEM ERROR: This query cannot be planned possibly due to either a cartesian join or an inequality join [Error Id: 80b10ec8-add6-45fd-8f1a-1e68852936a2 on atsqa4-133.qa.lab:31010] (state=,code=0) 0: jdbc:drill:schema=dfs> {code} Works with two non distinct scalar aggregates: {code} 0: jdbc:drill:schema=dfs> select * from t1 where a1 > ( select count(a2) + count(a2) from t2); +------------+------------+------------+ | a1 | b1 | c1 | +------------+------------+------------+ +------------+------------+------------+ No rows selected (0.244 seconds) {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)