You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2020/05/19 21:59:25 UTC
[arrow] branch master updated: ARROW-8862: [C++] NumericBuilder
should use MemoryPool passed to CTOR
This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 741a95c ARROW-8862: [C++] NumericBuilder should use MemoryPool passed to CTOR
741a95c is described below
commit 741a95cb9a9fff86e2b0c8e53a7e06d6b5c171bc
Author: Simon Watts <sa...@users.noreply.github.com>
AuthorDate: Wed May 20 06:58:53 2020 +0900
ARROW-8862: [C++] NumericBuilder should use MemoryPool passed to CTOR
`NumericBuilder` uses the `pool` (`MemoryPool*`) parameter to initialise the `ArrayBuilder` base class, but does not use it to initialise its own internal builder, `data_builder_` (`TypedBufferBuilder`). For comparison `ArrayBuilder` uses the `pool` to initialise its own `null_bitmap_builder_` member (also a `TypedBufferBuilder`).
This effect was observed when trying to switch to a custom `MemoryPool` for performance reasons. A hook was used to detect any use of the `MemoryPool` proved by `default_memory_pool()`.
Closes #7227 from sawatts/patch-1
Authored-by: Simon Watts <sa...@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
cpp/src/arrow/array/builder_primitive.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpp/src/arrow/array/builder_primitive.h b/cpp/src/arrow/array/builder_primitive.h
index ae38c3b..d057f27 100644
--- a/cpp/src/arrow/array/builder_primitive.h
+++ b/cpp/src/arrow/array/builder_primitive.h
@@ -66,10 +66,10 @@ class NumericBuilder : public ArrayBuilder {
template <typename T1 = T>
explicit NumericBuilder(
enable_if_parameter_free<T1, MemoryPool*> pool = default_memory_pool())
- : ArrayBuilder(pool), type_(TypeTraits<T>::type_singleton()) {}
+ : ArrayBuilder(pool), type_(TypeTraits<T>::type_singleton()), data_builder_(pool) {}
NumericBuilder(const std::shared_ptr<DataType>& type, MemoryPool* pool)
- : ArrayBuilder(pool), type_(type) {}
+ : ArrayBuilder(pool), type_(type), data_builder_(pool) {}
/// Append a single scalar and increase the size if necessary.
Status Append(const value_type val) {