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


##########
cpp/src/arrow/compute/exec/asof_join_node.cc:
##########
@@ -459,17 +642,58 @@ class CompositeReferenceTable {
     if (!_ptr2ref.count((uintptr_t)ref.get())) _ptr2ref[(uintptr_t)ref.get()] 
= ref;
   }
 
-  template <class Builder, class PrimitiveType>
-  Result<std::shared_ptr<Array>> MaterializePrimitiveColumn(MemoryPool* 
memory_pool,
-                                                            size_t i_table,
-                                                            col_index_t i_col) 
{
-    Builder builder(memory_pool);
+  // this should really be a method on ArrayData
+  static bool IsNull(const std::shared_ptr<ArrayData>& source, row_index_t 
row) {
+    return ((source->buffers[0] != NULLPTR)
+                ? !bit_util::GetBit(source->buffers[0]->data(), row + 
source->offset)
+                : source->null_count.load() == source->length);
+  }
+
+  template <typename T>
+  using is_fixed_width_type = std::is_base_of<FixedWidthType, T>;
+
+  template <typename T, typename R = void>
+  using enable_if_fixed_width_type = 
enable_if_t<is_fixed_width_type<T>::value, R>;
+
+  template <class Type, class Builder = typename TypeTraits<Type>::BuilderType>
+  enable_if_fixed_width_type<Type, Status> static BuilderAppend(
+      Builder& builder, const std::shared_ptr<ArrayData>& source, row_index_t 
row) {
+    if (IsNull(source, row)) {
+      builder.UnsafeAppendNull();
+      return Status::OK();

Review Comment:
   It always returns `Status::OK`, but the other template of `BuilderAppend` 
below may return `Status::Invalid`, and the caller just treats both templates 
the same.



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