wgtmac commented on code in PR #44190:
URL: https://github.com/apache/arrow/pull/44190#discussion_r1818529355
##########
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 think this is a breaking change (for TimestampArray), where
PrimitiveArray::SetData is called in the PrimitiveArray::PrimitiveArray. The
code below can reproduce this issue.
```
TEST(TestPrettyPrintArray, TimestampArray) {
auto array = std::make_shared<TimestampArray>(
timestamp(TimeUnit::MICRO),
/*length=*/1, Buffer::FromVector(std::vector<int64_t>{0}));
auto v0 = array->GetView(0);
std::cout << v0 << std::endl;
}
```
cc @mapleFU @pitrou @raulcd
--
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]