Repository: incubator-quickstep
Updated Branches:
  refs/heads/lip-refactor-backend c28ffe1bb -> 41cdc1ba6


Updates


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

Branch: refs/heads/lip-refactor-backend
Commit: 41cdc1ba6fe1040e474394ddcc6a88f84a4d326a
Parents: c28ffe1
Author: Jianqiao Zhu <jianq...@cs.wisc.edu>
Authored: Sat Oct 22 15:27:25 2016 -0500
Committer: Jianqiao Zhu <jianq...@cs.wisc.edu>
Committed: Sat Oct 22 15:27:25 2016 -0500

----------------------------------------------------------------------
 relational_operators/HashJoinOperator.cpp | 107 ++++++++++++++++---------
 relational_operators/HashJoinOperator.hpp |  15 +++-
 relational_operators/SelectOperator.cpp   |  21 +++--
 relational_operators/WorkOrder.proto      |   5 +-
 relational_operators/WorkOrderFactory.cpp |  25 +++---
 storage/AggregationOperationState.cpp     |  16 ++--
 storage/StorageBlock.cpp                  |  24 +-----
 storage/StorageBlock.hpp                  |   6 --
 8 files changed, 117 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/relational_operators/HashJoinOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/HashJoinOperator.cpp 
b/relational_operators/HashJoinOperator.cpp
index eeb2096..4a91f86 100644
--- a/relational_operators/HashJoinOperator.cpp
+++ b/relational_operators/HashJoinOperator.cpp
@@ -97,9 +97,8 @@ class MapBasedJoinedTupleCollector {
 
 class SemiAntiJoinTupleCollector {
  public:
-  explicit SemiAntiJoinTupleCollector(TupleIdSequence *existence_map) {
-    filter_ = existence_map;
-  }
+  explicit SemiAntiJoinTupleCollector(TupleIdSequence *filter)
+      : filter_(filter) {}
 
   template <typename ValueAccessorT>
   inline void operator()(const ValueAccessorT &accessor) {
@@ -112,9 +111,8 @@ class SemiAntiJoinTupleCollector {
 
 class OuterJoinTupleCollector {
  public:
-  explicit OuterJoinTupleCollector(const TupleStorageSubBlock &tuple_store) {
-    filter_.reset(tuple_store.getExistenceMap());
-  }
+  explicit OuterJoinTupleCollector(TupleIdSequence *filter)
+      : filter_(filter) {}
 
   template <typename ValueAccessorT>
   inline void operator()(const ValueAccessorT &accessor,
@@ -132,14 +130,10 @@ class OuterJoinTupleCollector {
     return &joined_tuples_;
   }
 
-  const TupleIdSequence* filter() const {
-    return filter_.get();
-  }
-
  private:
   std::unordered_map<block_id, std::vector<std::pair<tuple_id, tuple_id>>> 
joined_tuples_;
   // BitVector on the probe relation. 1 if the corresponding tuple has no 
match.
-  std::unique_ptr<TupleIdSequence> filter_;
+  TupleIdSequence *filter_;
 };
 
 }  // namespace
@@ -264,7 +258,8 @@ bool HashJoinOperator::getAllOuterJoinWorkOrders(
                   is_selection_on_build_,
                   hash_table,
                   output_destination,
-                  storage_manager),
+                  storage_manager,
+                  CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, 
query_context)),
               op_index_);
         }
         started_ = true;
@@ -284,7 +279,8 @@ bool HashJoinOperator::getAllOuterJoinWorkOrders(
                 is_selection_on_build_,
                 hash_table,
                 output_destination,
-                storage_manager),
+                storage_manager,
+                CreateLIPFilterAdaptiveProberHelper(lip_deployment_index_, 
query_context)),
             op_index_);
         ++num_workorders_generated_;
       }
@@ -409,6 +405,7 @@ serialization::WorkOrder* 
HashJoinOperator::createOuterJoinWorkOrderProto(const
   proto->SetExtension(serialization::HashJoinWorkOrder::join_hash_table_index, 
hash_table_index_);
   proto->SetExtension(serialization::HashJoinWorkOrder::selection_index, 
selection_index_);
   proto->SetExtension(serialization::HashJoinWorkOrder::block_id, block);
+  proto->SetExtension(serialization::HashJoinWorkOrder::lip_deployment_index, 
lip_deployment_index_);
 
   for (const bool is_attribute_on_build : is_selection_on_build_) {
     
proto->AddExtension(serialization::HashJoinWorkOrder::is_selection_on_build, 
is_attribute_on_build);
@@ -422,7 +419,6 @@ void HashInnerJoinWorkOrder::execute() {
   BlockReference probe_block(
       storage_manager_->getBlock(block_id_, probe_relation_));
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
 
   // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
@@ -539,7 +535,6 @@ void HashSemiJoinWorkOrder::executeWithResidualPredicate() {
   BlockReference probe_block = storage_manager_->getBlock(block_id_,
                                                           probe_relation_);
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
 
   // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
@@ -630,7 +625,6 @@ void 
HashSemiJoinWorkOrder::executeWithoutResidualPredicate() {
   BlockReference probe_block = storage_manager_->getBlock(block_id_,
                                                           probe_relation_);
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
 
   // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
@@ -675,15 +669,8 @@ void 
HashSemiJoinWorkOrder::executeWithoutResidualPredicate() {
                                     probe_block->getIndices(),
                                     probe_block->getIndicesConsistent());
 
-  std::unique_ptr<ValueAccessor> probe_accessor_with_filter;
-  if (base_accessor != nullptr) {
-    probe_accessor_with_filter.reset(
-      
base_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
-  } else {
-    probe_accessor_with_filter.reset(
+  std::unique_ptr<ValueAccessor> probe_accessor_with_filter(
       
probe_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
-  }
-
   ColumnVectorsValueAccessor temp_result;
   for (vector<unique_ptr<const Scalar>>::const_iterator selection_it = 
selection_.begin();
        selection_it != selection_.end(); ++selection_it) {
@@ -700,9 +687,22 @@ void 
HashAntiJoinWorkOrder::executeWithoutResidualPredicate() {
   BlockReference probe_block = storage_manager_->getBlock(block_id_,
                                                           probe_relation_);
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
-  std::unique_ptr<TupleIdSequence> 
existence_map(probe_store.getExistenceMap());
+
+  // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
+  std::unique_ptr<TupleIdSequence> existence_map;
+  std::unique_ptr<ValueAccessor> base_accessor;
+  if (lip_filter_adaptive_prober_ != nullptr) {
+    base_accessor.reset(probe_accessor.release());
+    existence_map.reset(
+        lip_filter_adaptive_prober_->filterValueAccessor(base_accessor.get()));
+    probe_accessor.reset(
+        
base_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
+  }
+
+  if (existence_map == nullptr) {
+    existence_map.reset(probe_store.getExistenceMap());
+  }
 
   SemiAntiJoinTupleCollector collector(existence_map.get());
   // We probe the hash table to find the keys which have an entry in the
@@ -746,8 +746,19 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() 
{
   BlockReference probe_block = storage_manager_->getBlock(block_id_,
                                                           probe_relation_);
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
+
+  // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
+  std::unique_ptr<TupleIdSequence> existence_map;
+  std::unique_ptr<ValueAccessor> base_accessor;
+  if (lip_filter_adaptive_prober_ != nullptr) {
+    base_accessor.reset(probe_accessor.release());
+    existence_map.reset(
+        lip_filter_adaptive_prober_->filterValueAccessor(base_accessor.get()));
+    probe_accessor.reset(
+        
base_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
+  }
+
   MapBasedJoinedTupleCollector collector;
   // We probe the hash table and get all the matches. Unlike
   // executeWithoutResidualPredicate(), we have to collect all the matching
@@ -767,8 +778,12 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() 
{
         &collector);
   }
 
-  // Create a filter for all the tuples from the given probe block.
-  std::unique_ptr<TupleIdSequence> filter(probe_store.getExistenceMap());
+  // If the existence map has not been initialized by the pre-filtering 
LIPFilters.
+  // Then create it for all the tuples from the given probe block.
+  if (existence_map == nullptr) {
+    existence_map.reset(probe_store.getExistenceMap());
+  }
+
   for (const std::pair<const block_id, std::vector<std::pair<tuple_id, 
tuple_id>>>
            &build_block_entry : *collector.getJoinedTuples()) {
     // First element of the pair build_block_entry is the build block ID
@@ -781,7 +796,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 (!filter->get(hash_match.second)) {
+      if (!existence_map->get(hash_match.second)) {
         // We have already seen this tuple, skip it.
         continue;
       }
@@ -791,9 +806,9 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() {
                                                       *probe_accessor,
                                                       probe_relation_id,
                                                       hash_match.second)) {
-        // Note that the filter marks a match as false, as needed by the anti
-        // join definition.
-        filter->set(hash_match.second, false);
+        // Note that the existence map marks a match as false, as needed by the
+        // anti join definition.
+        existence_map->set(hash_match.second, false);
       }
     }
   }
@@ -803,7 +818,7 @@ void HashAntiJoinWorkOrder::executeWithResidualPredicate() {
                                     probe_block->getIndicesConsistent());
 
   std::unique_ptr<ValueAccessor> probe_accessor_with_filter(
-      probe_store.createValueAccessor(filter.get()));
+      
probe_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
   ColumnVectorsValueAccessor temp_result;
   for (vector<unique_ptr<const Scalar>>::const_iterator selection_it = 
selection_.begin();
        selection_it != selection_.end();
@@ -823,9 +838,24 @@ void HashOuterJoinWorkOrder::execute() {
   const BlockReference probe_block = storage_manager_->getBlock(block_id_,
                                                                 
probe_relation_);
   const TupleStorageSubBlock &probe_store = 
probe_block->getTupleStorageSubBlock();
-
   std::unique_ptr<ValueAccessor> 
probe_accessor(probe_store.createValueAccessor());
-  OuterJoinTupleCollector collector(probe_store);
+
+  // Probe the LIPFilters to generate an existence bitmap for probe_accessor, 
if enabled.
+  std::unique_ptr<TupleIdSequence> existence_map;
+  std::unique_ptr<ValueAccessor> base_accessor;
+  if (lip_filter_adaptive_prober_ != nullptr) {
+    base_accessor.reset(probe_accessor.release());
+    existence_map.reset(
+        lip_filter_adaptive_prober_->filterValueAccessor(base_accessor.get()));
+    probe_accessor.reset(
+        
base_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
+  }
+
+  if (existence_map == nullptr) {
+    existence_map.reset(probe_store.getExistenceMap());
+  }
+
+  OuterJoinTupleCollector collector(existence_map.get());
   if (join_key_attributes_.size() == 1) {
     hash_table_.getAllFromValueAccessorWithExtraWorkForFirstMatch(
         probe_accessor.get(),
@@ -870,11 +900,10 @@ void HashOuterJoinWorkOrder::execute() {
                                     probe_block->getIndicesConsistent());
 
   // Populate the output tuples for non-matches.
-  const TupleIdSequence *filter = collector.filter();
-  const TupleIdSequence::size_type num_tuples_without_matches = filter->size();
+  const TupleIdSequence::size_type num_tuples_without_matches = 
existence_map->size();
   if (num_tuples_without_matches > 0) {
     std::unique_ptr<ValueAccessor> probe_accessor_with_filter(
-        probe_store.createValueAccessor(filter));
+        
probe_accessor->createSharedTupleIdSequenceAdapterVirtual(*existence_map));
     ColumnVectorsValueAccessor temp_result;
 
     for (std::size_t i = 0; i < selection_.size(); ++i) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/relational_operators/HashJoinOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/HashJoinOperator.hpp 
b/relational_operators/HashJoinOperator.hpp
index 566a367..0ed1eeb 100644
--- a/relational_operators/HashJoinOperator.hpp
+++ b/relational_operators/HashJoinOperator.hpp
@@ -700,6 +700,7 @@ class HashOuterJoinWorkOrder : public WorkOrder {
    * @param hash_table The JoinHashTable to use.
    * @param output_destination The InsertDestination to insert the join 
results.
    * @param storage_manager The StorageManager to use.
+   * @param lip_filter_adaptive_prober The attached LIP filter prober.
    **/
   HashOuterJoinWorkOrder(
       const std::size_t query_id,
@@ -712,7 +713,8 @@ class HashOuterJoinWorkOrder : public WorkOrder {
       const std::vector<bool> &is_selection_on_build,
       const JoinHashTable &hash_table,
       InsertDestination *output_destination,
-      StorageManager *storage_manager)
+      StorageManager *storage_manager,
+      LIPFilterAdaptiveProber *lip_filter_adaptive_prober)
       : WorkOrder(query_id),
         build_relation_(build_relation),
         probe_relation_(probe_relation),
@@ -723,7 +725,8 @@ class HashOuterJoinWorkOrder : public WorkOrder {
         is_selection_on_build_(is_selection_on_build),
         hash_table_(hash_table),
         output_destination_(output_destination),
-        storage_manager_(storage_manager) {}
+        storage_manager_(storage_manager),
+        lip_filter_adaptive_prober_(lip_filter_adaptive_prober) {}
 
   /**
    * @brief Constructor for the distributed version.
@@ -758,7 +761,8 @@ class HashOuterJoinWorkOrder : public WorkOrder {
       std::vector<bool> &&is_selection_on_build,
       const JoinHashTable &hash_table,
       InsertDestination *output_destination,
-      StorageManager *storage_manager)
+      StorageManager *storage_manager,
+      LIPFilterAdaptiveProber *lip_filter_adaptive_prober)
       : WorkOrder(query_id),
         build_relation_(build_relation),
         probe_relation_(probe_relation),
@@ -769,7 +773,8 @@ class HashOuterJoinWorkOrder : public WorkOrder {
         is_selection_on_build_(std::move(is_selection_on_build)),
         hash_table_(hash_table),
         output_destination_(output_destination),
-        storage_manager_(storage_manager) {}
+        storage_manager_(storage_manager),
+        lip_filter_adaptive_prober_(lip_filter_adaptive_prober) {}
 
   ~HashOuterJoinWorkOrder() override {}
 
@@ -788,6 +793,8 @@ class HashOuterJoinWorkOrder : public WorkOrder {
   InsertDestination *output_destination_;
   StorageManager *storage_manager_;
 
+  std::unique_ptr<LIPFilterAdaptiveProber> lip_filter_adaptive_prober_;
+
   DISALLOW_COPY_AND_ASSIGN(HashOuterJoinWorkOrder);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/relational_operators/SelectOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/SelectOperator.cpp 
b/relational_operators/SelectOperator.cpp
index 36a3fbe..e6c7bce 100644
--- a/relational_operators/SelectOperator.cpp
+++ b/relational_operators/SelectOperator.cpp
@@ -247,29 +247,34 @@ serialization::WorkOrder* 
SelectOperator::createWorkOrderProto(const block_id bl
   return proto;
 }
 
-
 void SelectWorkOrder::execute() {
   BlockReference block(
       storage_manager_->getBlock(input_block_id_, input_relation_, 
getPreferredNUMANodes()[0]));
 
-  std::unique_ptr<TupleIdSequence> lip_filter_matches;
+  std::unique_ptr<TupleIdSequence> predicate_matches;
+  if (predicate_ != nullptr) {
+    predicate_matches.reset(
+        block->getMatchesForPredicate(predicate_));
+  }
+
+  std::unique_ptr<TupleIdSequence> matches;
   if (lip_filter_adaptive_prober_ != nullptr) {
     std::unique_ptr<ValueAccessor> accessor(
-        block->getTupleStorageSubBlock().createValueAccessor());
-    lip_filter_matches.reset(
+        
block->getTupleStorageSubBlock().createValueAccessor(predicate_matches.get()));
+    matches.reset(
         lip_filter_adaptive_prober_->filterValueAccessor(accessor.get()));
+  } else {
+    matches.reset(predicate_matches.release());
   }
 
   if (simple_projection_) {
     block->selectSimple(simple_selection_,
-                        predicate_,
                         output_destination_,
-                        lip_filter_matches.get());
+                        matches.get());
   } else {
     block->select(*DCHECK_NOTNULL(selection_),
-                  predicate_,
                   output_destination_,
-                  lip_filter_matches.get());
+                  matches.get());
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/relational_operators/WorkOrder.proto
----------------------------------------------------------------------
diff --git a/relational_operators/WorkOrder.proto 
b/relational_operators/WorkOrder.proto
index a4200b0..86f34b8 100644
--- a/relational_operators/WorkOrder.proto
+++ b/relational_operators/WorkOrder.proto
@@ -131,9 +131,10 @@ message HashJoinWorkOrder {
 
     // Used by all but HashOuterJoinWorkOrder.
     optional int32 residual_predicate_index = 169;
-    optional int32 lip_deployment_index = 170;
     // Used by HashOuterJoinWorkOrder only.
-    repeated bool is_selection_on_build = 171;
+    repeated bool is_selection_on_build = 170;
+
+    optional int32 lip_deployment_index = 171;
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/relational_operators/WorkOrderFactory.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/WorkOrderFactory.cpp 
b/relational_operators/WorkOrderFactory.cpp
index 0b7f7e8..91a717f 100644
--- a/relational_operators/WorkOrderFactory.cpp
+++ b/relational_operators/WorkOrderFactory.cpp
@@ -264,7 +264,8 @@ WorkOrder* WorkOrderFactory::ReconstructFromProto(const 
serialization::WorkOrder
               move(is_selection_on_build),
               hash_table,
               output_destination,
-              storage_manager);
+              storage_manager,
+              lip_filter_adaptive_prober);
         }
         case serialization::HashJoinWorkOrder::HASH_SEMI_JOIN: {
           LOG(INFO) << "Creating HashSemiJoinWorkOrder";
@@ -592,6 +593,17 @@ bool WorkOrderFactory::ProtoIsValid(const 
serialization::WorkOrder &proto,
         }
       }
 
+      if 
(!proto.HasExtension(serialization::HashJoinWorkOrder::lip_deployment_index)) {
+        return false;
+      } else {
+        const QueryContext::lip_deployment_id lip_deployment_index =
+            
proto.GetExtension(serialization::HashJoinWorkOrder::lip_deployment_index);
+        if (lip_deployment_index != QueryContext::kInvalidLIPDeploymentId &&
+            !query_context.isValidLIPDeploymentId(lip_deployment_index)) {
+          return false;
+        }
+      }
+
       if (hash_join_work_order_type == 
serialization::HashJoinWorkOrder::HASH_OUTER_JOIN) {
         if 
(!proto.HasExtension(serialization::HashJoinWorkOrder::is_selection_on_build)) {
           return false;
@@ -602,17 +614,6 @@ bool WorkOrderFactory::ProtoIsValid(const 
serialization::WorkOrder &proto,
                  
proto.GetExtension(serialization::HashJoinWorkOrder::residual_predicate_index)))
 {
           return false;
         }
-
-        if 
(!proto.HasExtension(serialization::HashJoinWorkOrder::lip_deployment_index)) {
-          return false;
-        } else {
-          const QueryContext::lip_deployment_id lip_deployment_index =
-              
proto.GetExtension(serialization::HashJoinWorkOrder::lip_deployment_index);
-          if (lip_deployment_index != QueryContext::kInvalidLIPDeploymentId &&
-              !query_context.isValidLIPDeploymentId(lip_deployment_index)) {
-            return false;
-          }
-        }
       }
 
       return 
proto.HasExtension(serialization::HashJoinWorkOrder::any_join_key_attributes_nullable)
 &&

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/storage/AggregationOperationState.cpp
----------------------------------------------------------------------
diff --git a/storage/AggregationOperationState.cpp 
b/storage/AggregationOperationState.cpp
index f89fd7a..eb7ca79 100644
--- a/storage/AggregationOperationState.cpp
+++ b/storage/AggregationOperationState.cpp
@@ -417,18 +417,16 @@ void AggregationOperationState::aggregateBlockHashTable(
   BlockReference block(
       storage_manager_->getBlock(input_block, input_relation_));
 
-  // Apply LIPFilters first, and then the predicate, to generate a 
TupleIdSequence
+  // Apply the predicate first, then the LIPFilters, to generate a 
TupleIdSequence
   // as the existence map for the tuples.
   std::unique_ptr<TupleIdSequence> matches;
-  if (lip_filter_adaptive_prober != nullptr || predicate_ != nullptr) {
+  if (predicate_ != nullptr) {
+    matches.reset(block->getMatchesForPredicate(predicate_.get()));
+  }
+  if (lip_filter_adaptive_prober != nullptr) {
     std::unique_ptr<ValueAccessor> accessor(
-        block->getTupleStorageSubBlock().createValueAccessor());
-    if (lip_filter_adaptive_prober != nullptr) {
-      
matches.reset(lip_filter_adaptive_prober->filterValueAccessor(accessor.get()));
-    }
-    if (predicate_ != nullptr) {
-      matches.reset(block->getMatchesForPredicate(predicate_.get(), 
matches.get()));
-    }
+        block->getTupleStorageSubBlock().createValueAccessor(matches.get()));
+    
matches.reset(lip_filter_adaptive_prober->filterValueAccessor(accessor.get()));
   }
 
   // This holds values of all the GROUP BY attributes so that the can be reused

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/storage/StorageBlock.cpp
----------------------------------------------------------------------
diff --git a/storage/StorageBlock.cpp b/storage/StorageBlock.cpp
index 63acf7d..e306504 100644
--- a/storage/StorageBlock.cpp
+++ b/storage/StorageBlock.cpp
@@ -340,7 +340,6 @@ void StorageBlock::sample(const bool is_block_sample,
 }
 
 void StorageBlock::select(const vector<unique_ptr<const Scalar>> &selection,
-                          const Predicate *predicate,
                           InsertDestinationInterface *destination,
                           const TupleIdSequence *filter) const {
   ColumnVectorsValueAccessor temp_result;
@@ -349,18 +348,9 @@ void StorageBlock::select(const vector<unique_ptr<const 
Scalar>> &selection,
                                       indices_,
                                       indices_consistent_);
 
-    std::unique_ptr<ValueAccessor> base_accessor(
+    std::unique_ptr<ValueAccessor> accessor(
         tuple_store_->createValueAccessor(filter));
 
-    std::unique_ptr<TupleIdSequence> matches;
-    std::unique_ptr<ValueAccessor> accessor;
-    if (predicate != nullptr) {
-      matches.reset(getMatchesForPredicate(predicate));
-      
accessor.reset(base_accessor->createSharedTupleIdSequenceAdapterVirtual(*matches));
-    } else {
-      accessor.reset(base_accessor.release());
-    }
-
     for (vector<unique_ptr<const Scalar>>::const_iterator selection_cit = 
selection.begin();
          selection_cit != selection.end();
          ++selection_cit) {
@@ -374,21 +364,11 @@ void StorageBlock::select(const vector<unique_ptr<const 
Scalar>> &selection,
 }
 
 void StorageBlock::selectSimple(const std::vector<attribute_id> &selection,
-                                const Predicate *predicate,
                                 InsertDestinationInterface *destination,
                                 const TupleIdSequence *filter) const {
-  std::unique_ptr<ValueAccessor> base_accessor(
+  std::unique_ptr<ValueAccessor> accessor(
       tuple_store_->createValueAccessor(filter));
 
-  std::unique_ptr<TupleIdSequence> matches;
-  std::unique_ptr<ValueAccessor> accessor;
-  if (predicate != nullptr) {
-    matches.reset(getMatchesForPredicate(predicate));
-    
accessor.reset(base_accessor->createSharedTupleIdSequenceAdapterVirtual(*matches));
-  } else {
-    accessor.reset(base_accessor.release());
-  }
-
   destination->bulkInsertTuplesWithRemappedAttributes(selection,
                                                       accessor.get());
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/41cdc1ba/storage/StorageBlock.hpp
----------------------------------------------------------------------
diff --git a/storage/StorageBlock.hpp b/storage/StorageBlock.hpp
index 61a35fe..aef64ec 100644
--- a/storage/StorageBlock.hpp
+++ b/storage/StorageBlock.hpp
@@ -347,8 +347,6 @@ class StorageBlock : public StorageBlockBase {
    *
    * @param selection A list of scalars, which will be evaluated to obtain
    *        attribute values for each result tuple.
-   * @param predicate A predicate for selection. NULL indicates that all tuples
-   *        should be matched.
    * @param destination Where to insert the tuples resulting from the SELECT
    *        query.
    * @param filter If non-NULL, then only tuple IDs which are set in the
@@ -361,7 +359,6 @@ class StorageBlock : public StorageBlockBase {
    *
    **/
   void select(const std::vector<std::unique_ptr<const Scalar>> &selection,
-              const Predicate *predicate,
               InsertDestinationInterface *destination,
               const TupleIdSequence *filter) const;
 
@@ -370,8 +367,6 @@ class StorageBlock : public StorageBlockBase {
    *        projects attributes and does not evaluate expressions.
    *
    * @param selection The attributes to project.
-   * @param predicate A predicate for selection. NULL indicates that all tuples
-   *        should be matched.
    * @param destination Where to insert the tuples resulting from the SELECT
    *        query.
    * @param filter If non-NULL, then only tuple IDs which are set in the
@@ -387,7 +382,6 @@ class StorageBlock : public StorageBlockBase {
    *         an inconsistent IndexSubBlock (see indicesAreConsistent()).
    **/
   void selectSimple(const std::vector<attribute_id> &selection,
-                    const Predicate *predicate,
                     InsertDestinationInterface *destination,
                     const TupleIdSequence *filter) const;
 

Reply via email to