You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by zu...@apache.org on 2018/06/05 06:26:39 UTC
incubator-quickstep git commit: Fix a bug of filter side in
HashJoinOperator
Repository: incubator-quickstep
Updated Branches:
refs/heads/master dfefe6293 -> 97bef178f
Fix a bug of filter side in HashJoinOperator
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/97bef178
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/97bef178
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/97bef178
Branch: refs/heads/master
Commit: 97bef178fe403e14ebb304e60006fda2e988aac4
Parents: dfefe62
Author: Jianqiao Zhu <ji...@cs.wisc.edu>
Authored: Sun Jun 3 15:38:36 2018 -0500
Committer: Jianqiao Zhu <ji...@cs.wisc.edu>
Committed: Tue Jun 5 00:15:38 2018 -0500
----------------------------------------------------------------------
autofix_cmakelists.py | 11 ++--
.../tests/execution_generator/Join.test | 59 ++++++++++++++++++++
relational_operators/HashJoinOperator.cpp | 12 ++--
storage/CMakeLists.txt | 13 ++---
4 files changed, 77 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/97bef178/autofix_cmakelists.py
----------------------------------------------------------------------
diff --git a/autofix_cmakelists.py b/autofix_cmakelists.py
index 17ef588..ec19408 100755
--- a/autofix_cmakelists.py
+++ b/autofix_cmakelists.py
@@ -19,6 +19,7 @@
import os
import re
+import sys
from collections import defaultdict
@@ -1356,7 +1357,7 @@ class CMakeLists:
self.path = path
if "CMakeLists.txt" in os.listdir(path):
- with open(self.path + "/CMakeLists.txt", "rb") as file:
+ with open(self.path + "/CMakeLists.txt", "r") as file:
self.root = CMakeGroup(LineStream(file.readlines()))
self.newfile = False
else:
@@ -1524,8 +1525,8 @@ class CMakeLists:
continue
if name in subdirectories:
- print "Warning: Possibly duplicated add_subdirectory(" + \
- name + ") in", self.path
+ sys.stdout.write("Warning: Possibly duplicated add_subdirectory(" +
+ name + ") in" + self.path)
subdirectories[name] = node
@@ -1690,7 +1691,7 @@ class CMakeLists:
if len(output) == 0:
return
- with open(self.path + "/CMakeLists.txt", "wb") as file:
+ with open(self.path + "/CMakeLists.txt", "w") as file:
file.write("".join(output))
file.close()
@@ -1754,7 +1755,7 @@ class SourceFile:
self.includes = []
# Parse include items
- with open(self.path + "/" + self.name, "rb") as file:
+ with open(self.path + "/" + self.name, "r") as file:
dependencies = []
for line in file:
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/97bef178/query_optimizer/tests/execution_generator/Join.test
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/execution_generator/Join.test b/query_optimizer/tests/execution_generator/Join.test
index c26b915..5ef8e99 100644
--- a/query_optimizer/tests/execution_generator/Join.test
+++ b/query_optimizer/tests/execution_generator/Join.test
@@ -231,3 +231,62 @@ WHERE b.x > 10
+-----------+--------------------+------------------------+----------------+
| 6| 61| 601| C6|
+-----------+--------------------+------------------------+----------------+
+==
+
+# Semi-join w/o residual predicates
+SELECT SUM(x)
+FROM a
+WHERE w IN (SELECT w FROM b);
+--
++--------------------+
+|SUM(x) |
++--------------------+
+| 900|
++--------------------+
+==
+
+# Semi-join w/ residual predicates
+SELECT SUM(x)
+FROM a
+WHERE EXISTS (
+ SELECT *
+ FROM b
+ WHERE a.w = b.w
+ AND a.x < b.x
+);
+--
++--------------------+
+|SUM(x) |
++--------------------+
+| 500|
++--------------------+
+==
+
+# Anti-join w/o residual predicates
+SELECT SUM(x)
+FROM a
+WHERE w NOT IN (SELECT w FROM b);
+--
++--------------------+
+|SUM(x) |
++--------------------+
+| 1000|
++--------------------+
+==
+
+# Anti-join w residual predicates
+SELECT SUM(x)
+FROM a
+WHERE NOT EXISTS (
+ SELECT *
+ FROM b
+ WHERE a.w = b.w
+ AND a.x < b.x
+);
+--
++--------------------+
+|SUM(x) |
++--------------------+
+| 1400|
++--------------------+
+==
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/97bef178/relational_operators/HashJoinOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/HashJoinOperator.cpp b/relational_operators/HashJoinOperator.cpp
index f08de9d..a6283a8 100644
--- a/relational_operators/HashJoinOperator.cpp
+++ b/relational_operators/HashJoinOperator.cpp
@@ -733,9 +733,9 @@ void HashSemiJoinWorkOrder::executeWithResidualPredicate() {
build_store.createValueAccessor());
for (const std::pair<tuple_id, tuple_id> &hash_match
: build_block_entry.second) {
- // For each pair, 1st element is a tuple ID from the build relation in the
- // given build block, 2nd element is a tuple ID from the probe relation.
- if (filter.get(hash_match.second)) {
+ // For each pair, 1st element is a tuple ID from the probe relation, 2nd
+ // element is a tuple ID from the build relation in the given build block.
+ if (filter.get(hash_match.first)) {
// We have already found matches for this tuple that belongs to the
// probe side, skip it.
continue;
@@ -744,7 +744,7 @@ void HashSemiJoinWorkOrder::executeWithResidualPredicate() {
hash_match.first,
*build_accessor,
hash_match.second)) {
- filter.set(hash_match.second);
+ filter.set(hash_match.first);
}
}
}
@@ -949,7 +949,7 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() {
std::unique_ptr<ValueAccessor> build_accessor(build_store.createValueAccessor());
for (const std::pair<tuple_id, tuple_id> &hash_match
: build_block_entry.second) {
- if (!existence_map->get(hash_match.second)) {
+ if (!existence_map->get(hash_match.first)) {
// We have already seen this tuple, skip it.
continue;
}
@@ -959,7 +959,7 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() {
hash_match.second)) {
// Note that the existence map marks a match as false, as needed by the
// anti join definition.
- existence_map->set(hash_match.second, false);
+ existence_map->set(hash_match.first, false);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/97bef178/storage/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index 2bb9a7d..3ab1b2f 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -360,10 +360,6 @@ target_link_libraries(quickstep_storage_BasicColumnStoreValueAccessor
quickstep_utility_BitVector
quickstep_utility_Macros
quickstep_utility_PtrVector)
-if (ENABLE_NETWORK_CLI)
- target_link_libraries(quickstep_storage_BlockWire_proto
- ${PROTOBUF_LIBRARY})
-endif()
target_link_libraries(quickstep_storage_BloomFilterIndexSubBlock
glog
quickstep_catalog_CatalogAttribute
@@ -1102,7 +1098,10 @@ if (ENABLE_DISTRIBUTED)
endif()
if (ENABLE_NETWORK_CLI)
+ target_link_libraries(quickstep_storage_BlockWire_proto
+ ${PROTOBUF_LIBRARY})
target_link_libraries(quickstep_storage_DataProviderThread
+ ${GRPCPLUSPLUS_LIBRARIES}
glog
quickstep_catalog_CatalogDatabase
quickstep_catalog_CatalogRelation
@@ -1118,12 +1117,12 @@ if (ENABLE_NETWORK_CLI)
quickstep_threading_Thread
quickstep_threading_ThreadUtil
quickstep_utility_Macros
- tmb
- ${GRPCPLUSPLUS_LIBRARIES})
+ tmb)
target_link_libraries(quickstep_storage_StorageManager
${GRPCPLUSPLUS_LIBRARIES}
quickstep_storage_BlockWire_proto)
endif()
+
if (QUICKSTEP_HAVE_FILE_MANAGER_HDFS)
target_link_libraries(quickstep_storage_FileManagerHdfs
${LIBHDFS3_LIBRARIES}
@@ -1581,9 +1580,9 @@ if (ENABLE_NETWORK_CLI)
quickstep_queryexecution_WorkerDirectory
quickstep_queryoptimizer_QueryProcessor
quickstep_queryoptimizer_tests_TestDatabaseLoader
+ quickstep_storage_BlockWire_proto
quickstep_storage_DataProviderThread
quickstep_storage_StorageConstants
- quickstep_storage_BlockWire_proto
tmb)
add_test(DataProviderThread_unittest DataProviderThread_unittest)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data_provider_thread_test_data)