mapleFU commented on code in PR #44190: URL: https://github.com/apache/arrow/pull/44190#discussion_r1818532614
########## cpp/src/arrow/array/array_primitive.h: ########## @@ -90,26 +90,25 @@ class NumericArray : public PrimitiveArray { using value_type = typename TypeClass::c_type; using IteratorType = stl::ArrayIterator<NumericArray<TYPE>>; - explicit NumericArray(const std::shared_ptr<ArrayData>& data) : PrimitiveArray(data) {} + explicit NumericArray(const std::shared_ptr<ArrayData>& data) { SetData(data); } // Only enable this constructor without a type argument for types without additional // metadata template <typename T1 = TYPE> NumericArray(enable_if_parameter_free<T1, int64_t> length, const std::shared_ptr<Buffer>& data, const std::shared_ptr<Buffer>& null_bitmap = NULLPTR, - int64_t null_count = kUnknownNullCount, int64_t offset = 0) - : PrimitiveArray(TypeTraits<T1>::type_singleton(), length, data, null_bitmap, - null_count, offset) {} - - const value_type* raw_values() const { - return reinterpret_cast<const value_type*>(raw_values_) + data_->offset; + int64_t null_count = kUnknownNullCount, int64_t offset = 0) { + SetData(ArrayData::Make(TypeTraits<T1>::type_singleton(), length, {null_bitmap, data}, Review Comment: I've check here and this is because ``` template <typename TYPE> class NumericArray : public PrimitiveArray { using PrimitiveArray::PrimitiveArray; }; ``` This call `PrimitiveArray` without setting `values_` in `NumericArray`, leaving a uninitialized pointer here... -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org