----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30503/ -----------------------------------------------------------
Review request for drill, Jinfeng Ni and Mehant Baid. Bugs: DRILL-2092 https://issues.apache.org/jira/browse/DRILL-2092 Repository: drill-git Description ------- For queries of the form SELECT a, COUNT(DISTINCT b), SUM(b) FROM T GROUP BY a, Calcite generates a plan where there are 2 subqueries each of which corresponds to an aggregate function with group-by and the 2 subqeuries are joined in the outer query block on the group-by columns. This join-back uses 'IS NOT DISTINCT FROM' rather than equality..e.g here's an extract from the Explain: DrillJoinRel(condition=[AND(IS NOT DISTINCT FROM($0, $5), IS NOT DISTINCT FROM($1, $6))], joinType=[inner]) The IS NOT DISTINCT FROM differs from '=' in terms of null handling. null == null is FALSE, whereas null IS NOT DISTINCT FROM null is TRUE. This patch handles the nulls for this comparator both during planning and execution operations. Diffs ----- exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java fd6a3e2 exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java 4af0292 exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java PRE-CREATION exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java 14bc094 exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrel.java d9a7277 exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java d5473f2 exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/MergeJoinPrel.java f6b7ef6 exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java 2b3ff50 Diff: https://reviews.apache.org/r/30503/diff/ Testing ------- Added new unit tests. Ran unit tests, functional suite and tpch 100. Thanks, Aman Sinha