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 2016/05/27 03:23:37 UTC
[46/50] [abbrv] incubator-quickstep git commit: CatalogRelation
removed from DestroyHashOperator.
CatalogRelation removed from DestroyHashOperator.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/6757232f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/6757232f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/6757232f
Branch: refs/heads/partition_aware_hashjoin_with_optimizer_support
Commit: 6757232fbfa3351f441e3685dfa227e6e62f3da8
Parents: 2eb354a
Author: Adalbert Gerald Soosai Raj <ge...@cs.wisc.edu>
Authored: Thu May 26 12:26:12 2016 -0500
Committer: Adalbert Gerald Soosai Raj <ge...@cs.wisc.edu>
Committed: Thu May 26 12:26:12 2016 -0500
----------------------------------------------------------------------
catalog/CatalogDatabase.hpp | 2 +-
catalog/CatalogDatabaseLite.hpp | 10 ----------
query_optimizer/ExecutionGenerator.cpp | 9 ++++++++-
relational_operators/DestroyHashOperator.cpp | 8 +++-----
relational_operators/DestroyHashOperator.hpp | 20 ++++++++++----------
relational_operators/WorkOrder.proto | 4 ++--
relational_operators/WorkOrderFactory.cpp | 6 +++---
.../tests/HashJoinOperator_unittest.cpp | 12 ++++++------
8 files changed, 33 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/catalog/CatalogDatabase.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabase.hpp b/catalog/CatalogDatabase.hpp
index 6441bd4..0f784f4 100644
--- a/catalog/CatalogDatabase.hpp
+++ b/catalog/CatalogDatabase.hpp
@@ -290,7 +290,7 @@ class CatalogDatabase : public CatalogDatabaseLite {
* @param id The id to search for.
* @return The relation with the given ID.
**/
- const CatalogRelation* getRelationById(const relation_id id) const override {
+ const CatalogRelation* getRelationById(const relation_id id) const {
SpinSharedMutexSharedLock<false> lock(relations_mutex_);
if (hasRelationWithIdUnsafe(id)) {
return &rel_vec_[id];
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/catalog/CatalogDatabaseLite.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabaseLite.hpp b/catalog/CatalogDatabaseLite.hpp
index 85352af..a60798d 100644
--- a/catalog/CatalogDatabaseLite.hpp
+++ b/catalog/CatalogDatabaseLite.hpp
@@ -70,16 +70,6 @@ class CatalogDatabaseLite {
virtual const CatalogRelationSchema& getRelationSchemaById(const relation_id id) const = 0;
/**
- * @brief Get a relation by ID.
- *
- * @param id The id to search for.
- * @return The relation with the given ID.
- **/
- virtual const CatalogRelation* getRelationById(const relation_id id) const {
- return nullptr;
- }
-
- /**
* @brief Drop (delete) a relation by id.
*
* @param id The ID of the relation to drop.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index 4e3789c..4fb4dc8 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -917,9 +917,16 @@ void ExecutionGenerator::convertHashJoin(const P::HashJoinPtr &physical_plan) {
join_type));
insert_destination_proto->set_relational_op_index(join_operator_index);
+
+ std::size_t num_partitions = 0;
+
+ if (build_relation_info->relation->hasPartitionScheme()) {
+ num_partitions = build_relation_info->relation->getPartitionScheme().getPartitionSchemeHeader().getNumPartitions();
+ }
+
const QueryPlan::DAGNodeIndex destroy_operator_index =
execution_plan_->addRelationalOperator(
- new DestroyHashOperator(*build_relation_info->relation, join_hash_table_group_index, is_numa_aware_join));
+ new DestroyHashOperator(join_hash_table_group_index, num_partitions, is_numa_aware_join));
if (!build_relation_info->isStoredRelation()) {
execution_plan_->addDirectDependency(build_operator_index,
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/relational_operators/DestroyHashOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/DestroyHashOperator.cpp b/relational_operators/DestroyHashOperator.cpp
index 5bda139..e531458 100644
--- a/relational_operators/DestroyHashOperator.cpp
+++ b/relational_operators/DestroyHashOperator.cpp
@@ -33,17 +33,15 @@ bool DestroyHashOperator::getAllWorkOrders(
if (blocking_dependencies_met_ && !work_generated_) {
work_generated_ = true;
container->addNormalWorkOrder(
- new DestroyHashWorkOrder(input_relation_, hash_table_group_index_, query_context, is_numa_aware_join_),
+ new DestroyHashWorkOrder(hash_table_group_index_, query_context, num_partitions_, is_numa_aware_join_),
op_index_);
}
return work_generated_;
}
void DestroyHashWorkOrder::execute() {
- if (input_relation_.hasPartitionScheme() && is_numa_aware_join_) {
- const std::size_t num_partitions =
- input_relation_.getPartitionScheme().getPartitionSchemeHeader().getNumPartitions();
- for (std::size_t part_id = 0; part_id < num_partitions; ++part_id) {
+ if (is_numa_aware_join_) {
+ for (std::size_t part_id = 0; part_id < num_partitions_; ++part_id) {
query_context_->destroyJoinHashTable(hash_table_group_index_, part_id);
}
} else {
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/relational_operators/DestroyHashOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DestroyHashOperator.hpp b/relational_operators/DestroyHashOperator.hpp
index 1c51b1a..a8228f5 100644
--- a/relational_operators/DestroyHashOperator.hpp
+++ b/relational_operators/DestroyHashOperator.hpp
@@ -61,11 +61,11 @@ class DestroyHashOperator : public RelationalOperator {
*
* @param hash_table_group_index The group index of the JoinHashTable in QueryContext.
**/
- explicit DestroyHashOperator(const CatalogRelation &input_relation,
- const QueryContext::join_hash_table_group_id hash_table_group_index,
+ explicit DestroyHashOperator(const QueryContext::join_hash_table_group_id hash_table_group_index,
+ const std::size_t num_partitions = 0,
bool is_numa_aware_join = false)
- : input_relation_(input_relation),
- hash_table_group_index_(hash_table_group_index),
+ : hash_table_group_index_(hash_table_group_index),
+ num_partitions_(num_partitions),
is_numa_aware_join_(is_numa_aware_join),
work_generated_(false) {}
@@ -78,8 +78,8 @@ class DestroyHashOperator : public RelationalOperator {
tmb::MessageBus *bus) override;
private:
- const CatalogRelation &input_relation_;
const QueryContext::join_hash_table_group_id hash_table_group_index_;
+ const std::size_t num_partitions_;
bool is_numa_aware_join_;
bool work_generated_;
@@ -97,14 +97,14 @@ class DestroyHashWorkOrder : public WorkOrder {
* @param hash_table_group_index The group index of the JoinHashTable in QueryContext.
* @param query_context The QueryContext to use.
**/
- DestroyHashWorkOrder(const CatalogRelation &input_relation,
- const QueryContext::join_hash_table_group_id hash_table_group_index,
+ DestroyHashWorkOrder(const QueryContext::join_hash_table_group_id hash_table_group_index,
QueryContext *query_context,
+ const std::size_t num_partitions,
bool is_numa_aware_join = false,
const numa_node_id numa_node = -1)
- : input_relation_(input_relation),
- hash_table_group_index_(hash_table_group_index),
+ : hash_table_group_index_(hash_table_group_index),
query_context_(DCHECK_NOTNULL(query_context)),
+ num_partitions_(num_partitions),
is_numa_aware_join_(is_numa_aware_join) {
if (numa_node != -1) {
preferred_numa_nodes_.push_back(numa_node);
@@ -116,9 +116,9 @@ class DestroyHashWorkOrder : public WorkOrder {
void execute() override;
private:
- const CatalogRelation &input_relation_;
const QueryContext::join_hash_table_group_id hash_table_group_index_;
QueryContext *query_context_;
+ const std::size_t num_partitions_;
bool is_numa_aware_join_;
DISALLOW_COPY_AND_ASSIGN(DestroyHashWorkOrder);
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/relational_operators/WorkOrder.proto
----------------------------------------------------------------------
diff --git a/relational_operators/WorkOrder.proto b/relational_operators/WorkOrder.proto
index 5914c19..e070c73 100644
--- a/relational_operators/WorkOrder.proto
+++ b/relational_operators/WorkOrder.proto
@@ -84,8 +84,8 @@ message DeleteWorkOrder {
message DestroyHashWorkOrder {
extend WorkOrder {
// All required.
- optional int32 relation_id = 112;
- optional uint32 join_hash_table_group_index = 113;
+ optional uint32 join_hash_table_group_index = 112;
+ optional uint32 num_partitions = 113;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/relational_operators/WorkOrderFactory.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/WorkOrderFactory.cpp b/relational_operators/WorkOrderFactory.cpp
index 5cc2395..99ddadb 100644
--- a/relational_operators/WorkOrderFactory.cpp
+++ b/relational_operators/WorkOrderFactory.cpp
@@ -113,9 +113,9 @@ WorkOrder* WorkOrderFactory::ReconstructFromProto(const serialization::WorkOrder
case serialization::DESTROY_HASH: {
LOG(INFO) << "Creating DestroyHashWorkOrder";
return new DestroyHashWorkOrder(
- *(catalog_database->getRelationById(proto.GetExtension(serialization::DestroyHashWorkOrder::relation_id))),
proto.GetExtension(serialization::DestroyHashWorkOrder::join_hash_table_group_index),
- query_context);
+ query_context,
+ proto.GetExtension(serialization::DestroyHashWorkOrder::num_partitions));
}
case serialization::DROP_TABLE: {
LOG(INFO) << "Creating DropTableWorkOrder";
@@ -476,7 +476,7 @@ bool WorkOrderFactory::ProtoIsValid(const serialization::WorkOrder &proto,
return proto.HasExtension(serialization::DestroyHashWorkOrder::join_hash_table_group_index) &&
query_context.isValidJoinHashTableId(
proto.GetExtension(serialization::DestroyHashWorkOrder::join_hash_table_group_index)) &&
- proto.HasExtension(serialization::DestroyHashWorkOrder::relation_id);
+ proto.HasExtension(serialization::DestroyHashWorkOrder::num_partitions);
}
case serialization::DROP_TABLE: {
return true;
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6757232f/relational_operators/tests/HashJoinOperator_unittest.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/tests/HashJoinOperator_unittest.cpp b/relational_operators/tests/HashJoinOperator_unittest.cpp
index c103886..f9f50f4 100644
--- a/relational_operators/tests/HashJoinOperator_unittest.cpp
+++ b/relational_operators/tests/HashJoinOperator_unittest.cpp
@@ -421,7 +421,7 @@ TEST_P(HashJoinOperatorTest, LongKeyHashJoinTest) {
}
// Create cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());
@@ -588,7 +588,7 @@ TEST_P(HashJoinOperatorTest, IntDuplicateKeyHashJoinTest) {
}
// Create cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());
@@ -721,7 +721,7 @@ TEST_P(HashJoinOperatorTest, CharKeyCartesianProductHashJoinTest) {
}
// Create cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());
@@ -885,7 +885,7 @@ TEST_P(HashJoinOperatorTest, VarCharDuplicateKeyHashJoinTest) {
}
// Create the cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());
@@ -1058,7 +1058,7 @@ TEST_P(HashJoinOperatorTest, CompositeKeyHashJoinTest) {
}
// Create cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());
@@ -1242,7 +1242,7 @@ TEST_P(HashJoinOperatorTest, CompositeKeyHashJoinWithResidualPredicateTest) {
}
// Create cleaner operator.
- unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(*dim_table_, join_hash_table_group_index));
+ unique_ptr<DestroyHashOperator> cleaner(new DestroyHashOperator(join_hash_table_group_index));
cleaner->informAllBlockingDependenciesMet();
fetchAndExecuteWorkOrders(cleaner.get());