You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2017/05/04 19:39:06 UTC
[1/2] incubator-quickstep git commit: Fix a problem in CopyGroupList
+ minor style fixes.
Repository: incubator-quickstep
Updated Branches:
refs/heads/improve-pushdown [created] 7a6cac74f
Fix a problem in CopyGroupList + minor style fixes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/4e4866de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/4e4866de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/4e4866de
Branch: refs/heads/improve-pushdown
Commit: 4e4866de93e1eb0a1d4f99b0da9c92f8a8d09d6c
Parents: 8f66292
Author: Jianqiao Zhu <ji...@cs.wisc.edu>
Authored: Tue May 2 23:55:52 2017 -0500
Committer: Jianqiao Zhu <ji...@cs.wisc.edu>
Committed: Thu May 4 14:38:13 2017 -0500
----------------------------------------------------------------------
storage/SplitRowStoreTupleStorageSubBlock.cpp | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4e4866de/storage/SplitRowStoreTupleStorageSubBlock.cpp
----------------------------------------------------------------------
diff --git a/storage/SplitRowStoreTupleStorageSubBlock.cpp b/storage/SplitRowStoreTupleStorageSubBlock.cpp
index 0e5cfe6..f1c4636 100644
--- a/storage/SplitRowStoreTupleStorageSubBlock.cpp
+++ b/storage/SplitRowStoreTupleStorageSubBlock.cpp
@@ -332,16 +332,23 @@ tuple_id SplitRowStoreTupleStorageSubBlock::bulkInsertPartialTuplesImpl(
DCHECK_GE(relation_.getMaximumVariableByteLength(), varlen_reserve);
}
+ const std::size_t num_c_attr = contiguous_attrs.size();
+ const std::size_t num_n_attr = nullable_attrs.size();
+ const std::size_t num_v_attr = varlen_attrs.size();
+
InvokeOnAnyValueAccessor(
accessor,
[&](auto *accessor) -> void { // NOLINT(build/c++11
BitVector<true> tuple_null_bitmap(tuple_slot, num_null_attrs_);
const std::size_t nullmap_size = BitVector<true>::BytesNeeded(num_null_attrs_);
+<<<<<<< 8f662921bf8307aad1bddad74c5e9e037420246e
const std::size_t num_c_attr = contiguous_attrs.size();
const std::size_t num_n_attr = nullable_attrs.size();
const std::size_t num_v_attr = varlen_attrs.size();
+=======
+>>>>>>> Fix a problem in CopyGroupList + minor style fixes.
do {
while (num_tuples_inserted < max_num_tuples_to_insert && accessor->next()) {
char *attr_cursor = tuple_slot + nullmap_size;
[2/2] incubator-quickstep git commit: Improve disjunctive predicate
pushdown to optimize more scenarios.
Posted by ji...@apache.org.
Improve disjunctive predicate pushdown to optimize more scenarios.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/7a6cac74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/7a6cac74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/7a6cac74
Branch: refs/heads/improve-pushdown
Commit: 7a6cac74f86582944e43fa4714b69fe2a200c579
Parents: 4e4866d
Author: Jianqiao Zhu <ji...@cs.wisc.edu>
Authored: Wed May 3 17:59:54 2017 -0500
Committer: Jianqiao Zhu <ji...@cs.wisc.edu>
Committed: Thu May 4 14:38:58 2017 -0500
----------------------------------------------------------------------
.../PushDownLowCostDisjunctivePredicate.cpp | 34 ++++++++++++++------
storage/SplitRowStoreTupleStorageSubBlock.cpp | 7 ----
2 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7a6cac74/query_optimizer/rules/PushDownLowCostDisjunctivePredicate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/PushDownLowCostDisjunctivePredicate.cpp b/query_optimizer/rules/PushDownLowCostDisjunctivePredicate.cpp
index e39f155..1c71485 100644
--- a/query_optimizer/rules/PushDownLowCostDisjunctivePredicate.cpp
+++ b/query_optimizer/rules/PushDownLowCostDisjunctivePredicate.cpp
@@ -51,6 +51,11 @@ DEFINE_uint64(push_down_disjunctive_predicate_cardinality_threshold, 100u,
"PushDownLowCostDisjunctivePredicate optimization rule to push "
"down a disjunctive predicate to pre-filter that relation.");
+DEFINE_double(push_down_disjunctive_predicate_selectivity_threshold, 0.2,
+ "The estimated selectivity threshold below which the "
+ "PushDownLowCostDisjunctivePredicate optimization rule will push "
+ "down a disjunctive predicate to pre-filter a stored relation.");
+
namespace E = ::quickstep::optimizer::expressions;
namespace P = ::quickstep::optimizer::physical;
@@ -77,11 +82,7 @@ void PushDownLowCostDisjunctivePredicate::collectApplicablePredicates(
const physical::PhysicalPtr &input) {
P::TableReferencePtr table_reference;
if (P::SomeTableReference::MatchesWithConditionalCast(input, &table_reference)) {
- // Consider only stored relations with small cardinality as targets.
- if (cost_model_->estimateCardinality(input) <=
- FLAGS_push_down_disjunctive_predicate_cardinality_threshold) {
- applicable_nodes_.emplace_back(input, &table_reference->attribute_list());
- }
+ applicable_nodes_.emplace_back(input, &table_reference->attribute_list());
return;
}
@@ -191,11 +192,24 @@ P::PhysicalPtr PushDownLowCostDisjunctivePredicate::attachPredicates(
const auto &node_it = applicable_predicates_.find(input);
if (node_it != applicable_predicates_.end()) {
- const E::PredicatePtr filter_predicate =
- CreateConjunctive(node_it->second.predicates);
- return P::Selection::Create(output,
- E::ToNamedExpressions(output->getOutputAttributes()),
- filter_predicate);
+ const P::PhysicalPtr selection =
+ P::Selection::Create(output,
+ E::ToNamedExpressions(output->getOutputAttributes()),
+ CreateConjunctive(node_it->second.predicates));
+
+ // Applicable case 1: The stored relation has small cardinality.
+ const bool is_small_cardinality_relation =
+ cost_model_->estimateCardinality(input) <=
+ FLAGS_push_down_disjunctive_predicate_cardinality_threshold;
+
+ // Applicable case 2: The filter predicate has low selectivity.
+ const bool is_selective_predicate =
+ cost_model_->estimateSelectivityForFilterPredicate(selection) <=
+ FLAGS_push_down_disjunctive_predicate_selectivity_threshold;
+
+ if (is_small_cardinality_relation || is_selective_predicate) {
+ return selection;
+ }
}
return output;
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7a6cac74/storage/SplitRowStoreTupleStorageSubBlock.cpp
----------------------------------------------------------------------
diff --git a/storage/SplitRowStoreTupleStorageSubBlock.cpp b/storage/SplitRowStoreTupleStorageSubBlock.cpp
index f1c4636..0e5cfe6 100644
--- a/storage/SplitRowStoreTupleStorageSubBlock.cpp
+++ b/storage/SplitRowStoreTupleStorageSubBlock.cpp
@@ -332,23 +332,16 @@ tuple_id SplitRowStoreTupleStorageSubBlock::bulkInsertPartialTuplesImpl(
DCHECK_GE(relation_.getMaximumVariableByteLength(), varlen_reserve);
}
- const std::size_t num_c_attr = contiguous_attrs.size();
- const std::size_t num_n_attr = nullable_attrs.size();
- const std::size_t num_v_attr = varlen_attrs.size();
-
InvokeOnAnyValueAccessor(
accessor,
[&](auto *accessor) -> void { // NOLINT(build/c++11
BitVector<true> tuple_null_bitmap(tuple_slot, num_null_attrs_);
const std::size_t nullmap_size = BitVector<true>::BytesNeeded(num_null_attrs_);
-<<<<<<< 8f662921bf8307aad1bddad74c5e9e037420246e
const std::size_t num_c_attr = contiguous_attrs.size();
const std::size_t num_n_attr = nullable_attrs.size();
const std::size_t num_v_attr = varlen_attrs.size();
-=======
->>>>>>> Fix a problem in CopyGroupList + minor style fixes.
do {
while (num_tuples_inserted < max_num_tuples_to_insert && accessor->next()) {
char *attr_cursor = tuple_slot + nullmap_size;