Repository: incubator-quickstep
Updated Branches:
  refs/heads/partitioned-aggregate-new f6ab30f37 -> aaba94624 (forced update)


Remove unnecessary code from resize()

- In resize, all the values are moved from original hash table are
  copied to the new hash table using memcpy().
- Removed the for loop where values are constructed using 'new' operator, as
  all the values are trivially constructible in the specialized
  aggregation hash table implementation.


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

Branch: refs/heads/partitioned-aggregate-new
Commit: 2e0233333eb41d8f21f9e3f19029d08be8a01fdc
Parents: ad1f8c4
Author: Harshad Deshmukh <hbdeshm...@apache.org>
Authored: Wed Oct 5 16:05:05 2016 -0500
Committer: Harshad Deshmukh <hbdeshm...@apache.org>
Committed: Thu Oct 6 14:21:07 2016 -0500

----------------------------------------------------------------------
 storage/FastSeparateChainingHashTable.hpp | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/2e023333/storage/FastSeparateChainingHashTable.hpp
----------------------------------------------------------------------
diff --git a/storage/FastSeparateChainingHashTable.hpp 
b/storage/FastSeparateChainingHashTable.hpp
index 886a8ca..a41535c 100644
--- a/storage/FastSeparateChainingHashTable.hpp
+++ b/storage/FastSeparateChainingHashTable.hpp
@@ -1450,27 +1450,11 @@ void FastSeparateChainingHashTable<
   //       d. Relative pointers are not used with resizable hash tables.
   //     4. If values are not trivially copyable, then we invoke ValueT's copy
   //        or move constructor with placement new.
+  // NOTE(harshad) - Regarding point 4 above, as this is a specialized
+  // hash table implemented for aggregation, the values are trivially copyable,
+  // therefore we don't need to invoke payload values' copy/move constructors.
   std::memcpy(resized_buckets, buckets_, original_buckets_used * bucket_size_);
 
-  // TODO(chasseur): std::is_trivially_copyable is not yet implemented in
-  // GCC 4.8.3, so we assume we need to invoke ValueT's copy or move
-  // constructor, even though the plain memcpy above could suffice for many
-  // possible ValueTs.
-  void *current_value_original = static_cast<char *>(buckets_) + kValueOffset;
-  void *current_value_resized =
-      static_cast<char *>(resized_buckets) + kValueOffset;
-  for (std::size_t bucket_num = 0; bucket_num < original_buckets_used;
-       ++bucket_num) {
-    // Use a move constructor if available to avoid a deep-copy, since resizes
-    // always succeed.
-    new (current_value_resized) std::uint8_t(
-        std::move(*static_cast<std::uint8_t *>(current_value_original)));
-    current_value_original =
-        static_cast<char *>(current_value_original) + bucket_size_;
-    current_value_resized =
-        static_cast<char *>(current_value_resized) + bucket_size_;
-  }
-
   // Copy over variable-length key components, if any.
   if (original_variable_storage_used > 0) {
     DEBUG_ASSERT(original_variable_storage_used ==

Reply via email to