quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [15/46] incubator-quickstep git commit: Removed unused argument always_mark_full.
Date Mon, 26 Feb 2018 19:15:56 GMT
Removed unused argument always_mark_full.


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

Branch: refs/heads/fix-iwyu
Commit: f820c45ee56a9e74671fb1c22c5e6b7e13471b5d
Parents: ffb8e05
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Thu Oct 5 17:18:05 2017 -0500
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Tue Oct 10 14:14:29 2017 -0500

----------------------------------------------------------------------
 storage/InsertDestination.cpp          | 73 ++++++++++-------------------
 storage/InsertDestination.hpp          | 21 ++++-----
 storage/InsertDestinationInterface.hpp | 12 ++---
 3 files changed, 36 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f820c45e/storage/InsertDestination.cpp
----------------------------------------------------------------------
diff --git a/storage/InsertDestination.cpp b/storage/InsertDestination.cpp
index 8821019..c2b44d8 100644
--- a/storage/InsertDestination.cpp
+++ b/storage/InsertDestination.cpp
@@ -199,7 +199,7 @@ void InsertDestination::insertTupleInBatch(const Tuple &tuple) {
   returnBlock(std::move(output_block), false);
 }
 
-void InsertDestination::bulkInsertTuples(ValueAccessor *accessor, bool always_mark_full)
{
+void InsertDestination::bulkInsertTuples(ValueAccessor *accessor, const bool always_mark_full)
{
   InvokeOnAnyValueAccessor(
       accessor,
       [&](auto *accessor) -> void {  // NOLINT(build/c++11)
@@ -207,23 +207,17 @@ void InsertDestination::bulkInsertTuples(ValueAccessor *accessor, bool
always_ma
     while (!accessor->iterationFinished()) {
       MutableBlockReference output_block = this->getBlockForInsertion();
       // FIXME(chasseur): Deal with TupleTooLargeForBlock exception.
-      if (output_block->bulkInsertTuples(accessor) == 0) {
-        // output_block is full.
-        this->returnBlock(std::move(output_block), true);
-      } else {
-        // Bulk insert into output_block was successful. output_block
-        // will be rebuilt when there won't be any more insertions to it.
-        this->returnBlock(std::move(output_block),
-                          always_mark_full || !accessor->iterationFinished());
-      }
+      const auto num_tuples_inserted = output_block->bulkInsertTuples(accessor);
+      this->returnBlock(std::move(output_block),
+                        num_tuples_inserted == 0 || !accessor->iterationFinished() ||
+                            always_mark_full);
     }
   });
 }
 
 void InsertDestination::bulkInsertTuplesWithRemappedAttributes(
     const std::vector<attribute_id> &attribute_map,
-    ValueAccessor *accessor,
-    bool always_mark_full) {
+    ValueAccessor *accessor) {
   InvokeOnAnyValueAccessor(
       accessor,
       [&](auto *accessor) -> void {  // NOLINT(build/c++11)
@@ -231,17 +225,10 @@ void InsertDestination::bulkInsertTuplesWithRemappedAttributes(
     while (!accessor->iterationFinished()) {
       MutableBlockReference output_block = this->getBlockForInsertion();
       // FIXME(chasseur): Deal with TupleTooLargeForBlock exception.
-      if (output_block->bulkInsertTuplesWithRemappedAttributes(
-              attribute_map,
-              accessor) == 0) {
-        // output_block is full.
-        this->returnBlock(std::move(output_block), true);
-      } else {
-        // Bulk insert into output_block was successful. output_block
-        // will be rebuilt when there won't be any more insertions to it.
-        this->returnBlock(std::move(output_block),
-                          always_mark_full || !accessor->iterationFinished());
-      }
+      const auto num_tuples_inserted =
+          output_block->bulkInsertTuplesWithRemappedAttributes(attribute_map, accessor);
+      this->returnBlock(std::move(output_block),
+                        num_tuples_inserted == 0 || !accessor->iterationFinished());
     }
   });
 }
@@ -267,8 +254,7 @@ void removeGapOnlyAccessors(
 }
 
 void InsertDestination::bulkInsertTuplesFromValueAccessors(
-    const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map,
-    bool always_mark_full) {
+    const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map) {
   // Handle pathological corner case where there are no accessors
   if (accessor_attribute_map.size() == 0)
     return;
@@ -323,9 +309,7 @@ void InsertDestination::bulkInsertTuplesFromValueAccessors(
 
     // Update the header for output_block and then return it.
     output_block->bulkInsertPartialTuplesFinalize(num_tuples_inserted);
-    const bool mark_full = always_mark_full
-                           || !first_accessor->iterationFinishedVirtual();
-    this->returnBlock(std::move(output_block), mark_full);
+    this->returnBlock(std::move(output_block), !first_accessor->iterationFinishedVirtual());
   }
 }
 
@@ -606,7 +590,7 @@ void PartitionAwareInsertDestination::insertTupleInBatch(const Tuple &tuple)
{
   returnBlockInPartition(std::move(output_block), false, part_id);
 }
 
-void PartitionAwareInsertDestination::bulkInsertTuples(ValueAccessor *accessor, bool always_mark_full)
{
+void PartitionAwareInsertDestination::bulkInsertTuples(ValueAccessor *accessor, const bool
always_mark_full) {
   const std::size_t num_partitions = partition_scheme_header_->getNumPartitions();
 
   InvokeOnAnyValueAccessor(
@@ -639,29 +623,24 @@ void PartitionAwareInsertDestination::bulkInsertTuples(ValueAccessor
*accessor,
       adapter[partition]->beginIteration();
       while (!adapter[partition]->iterationFinished()) {
         MutableBlockReference output_block = this->getBlockForInsertionInPartition(partition);
-        if (output_block->bulkInsertTuples(adapter[partition].get()) == 0) {
-          this->returnBlockInPartition(std::move(output_block), true, partition);
-        } else {
-          // Bulk insert into output_block was successful. output_block
-          // will be rebuilt when there won't be any more insertions to it.
-          this->returnBlockInPartition(std::move(output_block),
-                                       always_mark_full || !adapter[partition]->iterationFinished(),
-                                       partition);
-        }
+        const auto num_tuples_inserted = output_block->bulkInsertTuples(adapter[partition].get());
+        this->returnBlockInPartition(std::move(output_block),
+                                     num_tuples_inserted == 0 || !adapter[partition]->iterationFinished()
||
+                                         always_mark_full,
+                                     partition);
       }
     }
   });
 }
 
 void PartitionAwareInsertDestination::bulkInsertTuplesWithRemappedAttributes(
-    const std::vector<attribute_id> &attribute_map, ValueAccessor *accessor, bool
always_mark_full) {
+    const std::vector<attribute_id> &attribute_map, ValueAccessor *accessor) {
   const std::size_t num_partitions = partition_scheme_header_->getNumPartitions();
 
   InvokeOnAnyValueAccessor(
       accessor,
       [this,
        &attribute_map,
-       &always_mark_full,
        &num_partitions](auto *accessor) -> void {  // NOLINT(build/c++11)
     std::vector<std::unique_ptr<TupleIdSequence>> partition_membership(num_partitions);
 
@@ -688,15 +667,11 @@ void PartitionAwareInsertDestination::bulkInsertTuplesWithRemappedAttributes(
       adapter[partition]->beginIteration();
       while (!adapter[partition]->iterationFinished()) {
         MutableBlockReference output_block = this->getBlockForInsertionInPartition(partition);
-        if (output_block->bulkInsertTuplesWithRemappedAttributes(attribute_map, adapter[partition].get())
== 0) {
-          this->returnBlockInPartition(std::move(output_block), true, partition);
-        } else {
-          // Bulk insert into output_block was successful. output_block
-          // will be rebuilt when there won't be any more insertions to it.
-          this->returnBlockInPartition(std::move(output_block),
-                                       always_mark_full || !adapter[partition]->iterationFinished(),
-                                       partition);
-        }
+        const auto num_tuple_inserted =
+            output_block->bulkInsertTuplesWithRemappedAttributes(attribute_map, adapter[partition].get());
+        this->returnBlockInPartition(std::move(output_block),
+                                     num_tuple_inserted == 0 || !adapter[partition]->iterationFinished(),
+                                     partition);
       }
     }
   });

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f820c45e/storage/InsertDestination.hpp
----------------------------------------------------------------------
diff --git a/storage/InsertDestination.hpp b/storage/InsertDestination.hpp
index ab791b1..3b39aeb 100644
--- a/storage/InsertDestination.hpp
+++ b/storage/InsertDestination.hpp
@@ -156,16 +156,15 @@ class InsertDestination : public InsertDestinationInterface {
 
   void insertTupleInBatch(const Tuple &tuple) override;
 
-  void bulkInsertTuples(ValueAccessor *accessor, bool always_mark_full = false) override;
+  void bulkInsertTuples(ValueAccessor *accessor,
+                        const bool always_mark_full = false) override;
 
   void bulkInsertTuplesWithRemappedAttributes(
       const std::vector<attribute_id> &attribute_map,
-      ValueAccessor *accessor,
-      bool always_mark_full = false) override;
+      ValueAccessor *accessor) override;
 
   void bulkInsertTuplesFromValueAccessors(
-      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map,
-      bool always_mark_full = false) override;
+      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map) override;
 
   void insertTuplesFromVector(std::vector<Tuple>::const_iterator begin,
                               std::vector<Tuple>::const_iterator end) override;
@@ -363,8 +362,7 @@ class AlwaysCreateBlockInsertDestination : public InsertDestination {
   }
 
   void bulkInsertTuplesFromValueAccessors(
-      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map,
-      bool always_mark_full = false) override {
+      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map) override {
     LOG(FATAL) << "bulkInsertTuplesFromValueAccessors is not implemented for AlwaysCreateBlockInsertDestination";
   }
 
@@ -551,16 +549,15 @@ class PartitionAwareInsertDestination : public InsertDestination {
 
   void insertTupleInBatch(const Tuple &tuple) override;
 
-  void bulkInsertTuples(ValueAccessor *accessor, bool always_mark_full = false) override;
+  void bulkInsertTuples(ValueAccessor *accessor,
+                        const bool always_mark_full = false) override;
 
   void bulkInsertTuplesWithRemappedAttributes(
       const std::vector<attribute_id> &attribute_map,
-      ValueAccessor *accessor,
-      bool always_mark_full = false) override;
+      ValueAccessor *accessor) override;
 
   void bulkInsertTuplesFromValueAccessors(
-      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map,
-      bool always_mark_full = false) override {
+      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map) override {
     LOG(FATAL) << "bulkInsertTuplesFromValueAccessors is not implemented for PartitionAwareInsertDestination";
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f820c45e/storage/InsertDestinationInterface.hpp
----------------------------------------------------------------------
diff --git a/storage/InsertDestinationInterface.hpp b/storage/InsertDestinationInterface.hpp
index b8c584b..7b87a98 100644
--- a/storage/InsertDestinationInterface.hpp
+++ b/storage/InsertDestinationInterface.hpp
@@ -104,7 +104,7 @@ class InsertDestinationInterface {
    *        insertion from ValueAccessor even when partially full.
    **/
   virtual void bulkInsertTuples(ValueAccessor *accessor,
-                                bool always_mark_full = false) = 0;
+                                const bool always_mark_full = false) = 0;
 
   /**
    * @brief Bulk-insert tuples from a ValueAccessor with differently-ordered
@@ -115,13 +115,10 @@ class InsertDestinationInterface {
    *        corresponding attributes which should be read from accessor.
    * @param accessor A ValueAccessor whose tuples will by inserted into blocks
    *        from this InsertDestination.
-   * @param always_mark_full If \c true, always mark the blocks full after
-   *        insertion from ValueAccessor even when partially full.
    **/
   virtual void bulkInsertTuplesWithRemappedAttributes(
       const std::vector<attribute_id> &attribute_map,
-      ValueAccessor *accessor,
-      bool always_mark_full = false) = 0;
+      ValueAccessor *accessor) = 0;
 
   /**
    * @brief Bulk-insert tuples from one or more ValueAccessors
@@ -137,12 +134,9 @@ class InsertDestinationInterface {
    *        is the attribute_id "n" in corresponding input value accessor.
    *        Set the i-th element to kInvalidCatalogId if it doesn't come from
    *        the corresponding value accessor.
-   * @param always_mark_full If \c true, always mark the blocks full after
-   *        insertion from ValueAccessor even when partially full.
    **/
   virtual void bulkInsertTuplesFromValueAccessors(
-      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map,
-      bool always_mark_full = false) = 0;
+      const std::vector<std::pair<ValueAccessor *, std::vector<attribute_id>>>
&accessor_attribute_map) = 0;
 
   /**
    * @brief Insert tuples from a range of Tuples in a vector.


Mime
View raw message