cyb70289 commented on code in PR #13583:
URL: https://github.com/apache/arrow/pull/13583#discussion_r921727349


##########
cpp/src/arrow/util/hashing.h:
##########
@@ -485,6 +485,20 @@ class ScalarMemoTable : public MemoTable {
   hash_t ComputeHash(const Scalar& value) const {
     return ScalarHelper<Scalar, 0>::ComputeHash(value);
   }
+
+ public:
+  // defined here so that `HashTableType` is visible
+  // Merge entries from `other_table` into `this->hash_table_`.
+  Status MergeTable(ScalarMemoTable& other_table) {

Review Comment:
   `const ScalarMemoTable&`



##########
cpp/src/arrow/util/hashing.h:
##########
@@ -568,6 +582,15 @@ class SmallScalarMemoTable : public MemoTable {
   // (which is also 1 + the largest memo index)
   int32_t size() const override { return 
static_cast<int32_t>(index_to_value_.size()); }
 
+  // Merge entries from `other_table` into `this`.
+  Status MergeTable(SmallScalarMemoTable& other_table) {

Review Comment:
   ditto



##########
cpp/src/arrow/util/hashing.h:
##########
@@ -485,6 +485,20 @@ class ScalarMemoTable : public MemoTable {
   hash_t ComputeHash(const Scalar& value) const {
     return ScalarHelper<Scalar, 0>::ComputeHash(value);
   }
+
+ public:
+  // defined here so that `HashTableType` is visible
+  // Merge entries from `other_table` into `this->hash_table_`.
+  Status MergeTable(ScalarMemoTable& other_table) {
+    HashTableType& other_hashtable = other_table.hash_table_;

Review Comment:
   `const HashTableType&`



##########
cpp/src/arrow/util/hashing.h:
##########
@@ -485,6 +485,20 @@ class ScalarMemoTable : public MemoTable {
   hash_t ComputeHash(const Scalar& value) const {
     return ScalarHelper<Scalar, 0>::ComputeHash(value);
   }
+
+ public:
+  // defined here so that `HashTableType` is visible
+  // Merge entries from `other_table` into `this->hash_table_`.
+  Status MergeTable(ScalarMemoTable& other_table) {
+    HashTableType& other_hashtable = other_table.hash_table_;
+
+    other_hashtable.VisitEntries([this](const HashTableEntry* other_entry) {
+      int32_t unused;
+      DCHECK_OK(this->GetOrInsert(other_entry->payload.value, &unused));
+    });
+    // TODO: implement proper (and perhaps more performant) error handling

Review Comment:
   I saw an issue created (ARROW-17074). We can write the jira number here 
directly.



##########
cpp/src/arrow/util/hashing.h:
##########
@@ -824,6 +847,15 @@ class BinaryMemoTable : public MemoTable {
     };
     return hash_table_.Lookup(h, cmp_func);
   }
+
+ public:
+  Status MergeTable(BinaryMemoTable& other_table) {

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to