rtpsw commented on code in PR #13880:
URL: https://github.com/apache/arrow/pull/13880#discussion_r951144684


##########
cpp/src/arrow/compute/exec/asof_join_node.cc:
##########
@@ -184,18 +280,51 @@ class InputState {
     return queue_.UnsyncFront();
   }
 
+#define LATEST_VAL_CASE(id, val)                            \
+  case Type::id: {                                          \
+    using T = typename TypeIdTraits<Type::id>::Type;        \
+    using CType = typename TypeTraits<T>::CType;            \
+    return val(data->GetValues<CType>(1)[latest_ref_row_]); \
+  }
+
   KeyType GetLatestKey() const {
-    return queue_.UnsyncFront()
-        ->column_data(key_col_index_)
-        ->GetValues<KeyType>(1)[latest_ref_row_];
+    if (key_hasher_ != NULLPTR) {
+      return 
key_hasher_->HashesFor(queue_.UnsyncFront().get())[latest_ref_row_];

Review Comment:
   The [`HashesFor` method caches by the batch 
pointer](https://github.com/apache/arrow/pull/13880/commits/e8177a3775b579cecdc74c6e4ee0e24de84ff9bf#diff-5789a42aebc3bd0f5a6db687c78ab0c3eef3e316982f99fe9e0ea21fabed354cR199-R201),
 so a rehash will only occur when the batch changes. This applies in the 
context of a particular input table, which is associated with a one key hasher 
(when one is defined).



-- 
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