impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [1/2] incubator-impala git commit: Add functional and targeted perf tests for joins with empty builds
Date Fri, 19 Aug 2016 23:42:38 GMT
Repository: incubator-impala
Updated Branches:
  refs/heads/master 1bbd667fd -> 2aa86309d


Add functional and targeted perf tests for joins with empty builds

I wrote these tests for my IMPALA-3987 patch, but other issues block
that optimisations.  These tests exercise an interesting corner case
so I split them out into a separate patch.

The functional tests exercise every join mode for nested loop join and
hash join with an empty build side. The perf test exercises hash join
with an empty build side.

Testing:
Made sure the tests passed with both partitioned and non-partitioned
hash join implementations. Ran the targeted perf query through the
single node perf run script to make sure it worked.

Change-Id: I0a68cafec32011a47c569b254979601237e7f2a5
Reviewed-on: http://gerrit.cloudera.org:8080/4051
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/f613dcd0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/f613dcd0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/f613dcd0

Branch: refs/heads/master
Commit: f613dcd02da989204026999b26247a024fb199ab
Parents: 1bbd667
Author: Tim Armstrong <tarmstrong@cloudera.com>
Authored: Wed Aug 17 00:35:14 2016 -0700
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Fri Aug 19 06:04:18 2016 +0000

----------------------------------------------------------------------
 .../queries/QueryTest/empty-build-joins.test    | 192 +++++++++++++++++++
 .../queries/QueryTest/single-node-nlj.test      |  52 +++++
 .../queries/primitive_empty_build_join_1.test   |  13 ++
 tests/query_test/test_join_queries.py           |   5 +
 4 files changed, 262 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f613dcd0/testdata/workloads/functional-query/queries/QueryTest/empty-build-joins.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/empty-build-joins.test
b/testdata/workloads/functional-query/queries/QueryTest/empty-build-joins.test
new file mode 100644
index 0000000..3aa9994
--- /dev/null
+++ b/testdata/workloads/functional-query/queries/QueryTest/empty-build-joins.test
@@ -0,0 +1,192 @@
+====
+---- QUERY
+# Inner equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+  inner join functional.alltypestiny att on at.id = att.id
+where att.int_col = 999
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Right equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+  right join functional.alltypestiny att on at.id = att.id
+where att.int_col = 999
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Left equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+  left join (
+    select * from functional.alltypestiny where int_col = 999) att on at.id = att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Full outer equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+  full outer join (
+    select * from functional.alltypestiny where int_col = 999) att on at.id = att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Left semi equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+where id in (
+  select id from functional.alltypestiny
+  where id = 999)
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Right semi equi-join - executes with hash join.
+select straight_join at.id
+from (select * from functional.alltypestiny att where int_col = 999) att
+  right semi join alltypes at on at.id = att.id
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Left NAAJ equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+where id not in (
+  select id from functional.alltypestiny
+  where id = 999)
+order by id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Left anti equi-join - executes with hash join.
+select straight_join at.id
+from alltypes at
+where not exists (
+  select id from functional.alltypestiny att
+    where id = 999 and att.id = at.id)
+order by id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Right anti equi-join - executes with hash join.
+select straight_join at.id
+from (select * from functional.alltypestiny att where int_col = 999) att
+  right anti join alltypes at on at.id = att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Inner non-equi-join - executes with nested loop join.
+select straight_join at.id
+from alltypes at
+  inner join functional.alltypestiny att on at.id < att.id
+where att.int_col = 999
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Cross join - executes with nested loop join.
+select straight_join at.id
+from alltypes at, functional.alltypestiny att
+where att.int_col = 999
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Left non-equi-join - executes with nested loop join.
+select straight_join at.id
+from alltypes at
+  left join (
+    select * from functional.alltypestiny where int_col = 999) att on at.id < att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Left semi non-equi-join - executes with nested loop join.
+select straight_join at.id
+from alltypes at
+   left semi join (
+     select * from functional.alltypestiny att where int_col = 999) att on at.id < att.id
+order by at.id desc
+limit 5
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Left anti non-equi-join - executes with nested loop join.
+select straight_join at.id
+from alltypes at left anti join (
+  select * from functional.alltypestiny att
+  where id = 999) att on at.id < att.id
+order by id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f613dcd0/testdata/workloads/functional-query/queries/QueryTest/single-node-nlj.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/single-node-nlj.test b/testdata/workloads/functional-query/queries/QueryTest/single-node-nlj.test
index bb22e16..49cdf9d 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/single-node-nlj.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/single-node-nlj.test
@@ -160,3 +160,55 @@ left join functional.alltypes a2 on a2.tinyint_col >= 1
 ---- TYPES
 BIGINT
 ====
+---- QUERY
+# Right non-equi-join with empty build.
+select straight_join at.id
+from alltypes at
+  right join functional.alltypestiny att on at.id < att.id
+where att.int_col = 999
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Full outer non-equi-join with empty build.
+select straight_join at.id
+from alltypes at
+  full outer join (
+    select * from functional.alltypestiny where int_col = 999) att on at.id < att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====
+---- QUERY
+# Right semi non-equi-join with empty build.
+select straight_join at.id
+from (select * from functional.alltypestiny att where int_col = 999) att
+  right semi join alltypes at on at.id < att.id
+---- RESULTS
+---- TYPES
+INT
+====
+---- QUERY
+# Right anti non-equi-join with empty build.
+select straight_join at.id
+from (select * from functional.alltypestiny att where int_col = 999) att
+  right anti join alltypes at on at.id < att.id
+order by at.id desc
+limit 5
+---- RESULTS
+7299
+7298
+7297
+7296
+7295
+---- TYPES
+INT
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f613dcd0/testdata/workloads/targeted-perf/queries/primitive_empty_build_join_1.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/targeted-perf/queries/primitive_empty_build_join_1.test b/testdata/workloads/targeted-perf/queries/primitive_empty_build_join_1.test
new file mode 100644
index 0000000..ef0a47f
--- /dev/null
+++ b/testdata/workloads/targeted-perf/queries/primitive_empty_build_join_1.test
@@ -0,0 +1,13 @@
+====
+---- QUERY: primitive_empty_build_join_1
+-- Description : Join with empty build side and large probe side.
+-- Target test case : Analytic query with selective filters where evaluation of
+--   the join can be short-circuited for a dramatic speedup.
+SELECT /* +straight_join */ *
+FROM lineitem
+INNER JOIN orders ON l_orderkey = o_orderkey
+WHERE o_comment = 'no matching comments'
+---- RESULTS
+---- TYPES
+====
+

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f613dcd0/tests/query_test/test_join_queries.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_join_queries.py b/tests/query_test/test_join_queries.py
index 3acd97e..14965d8 100644
--- a/tests/query_test/test_join_queries.py
+++ b/tests/query_test/test_join_queries.py
@@ -86,6 +86,11 @@ class TestJoinQueries(ImpalaTestSuite):
     new_vector.get_value('exec_option')['num_nodes'] = 1
     self.run_test_case('QueryTest/single-node-nlj-exhaustive', new_vector)
 
+  def test_empty_build_joins(self, vector):
+    new_vector = copy(vector)
+    new_vector.get_value('exec_option')['batch_size'] = vector.get_value('batch_size')
+    self.run_test_case('QueryTest/empty-build-joins', new_vector)
+
 class TestTPCHJoinQueries(ImpalaTestSuite):
   # Uses the TPC-H dataset in order to have larger joins. Needed for example to test
   # the repartitioning codepaths.


Mime
View raw message