kszucs commented on code in PR #45688: URL: https://github.com/apache/arrow/pull/45688#discussion_r1991892908
########## cpp/src/parquet/column_writer.cc: ########## @@ -1364,6 +1367,41 @@ class TypedColumnWriterImpl : public ColumnWriterImpl, public TypedColumnWriter< int64_t num_levels, const ::arrow::Array& array, ArrowWriteContext* context, bool maybe_parent_nulls); + template <typename ArrowType> + Status WriteArrowSerialize(const int16_t* def_levels, const int16_t* rep_levels, + int64_t num_levels, const ::arrow::Array& array, + ArrowWriteContext* ctx, bool maybe_parent_nulls); + + Status WriteArrowZeroCopy(const int16_t* def_levels, const int16_t* rep_levels, + int64_t num_levels, const ::arrow::Array& array, + ArrowWriteContext* ctx, bool maybe_parent_nulls) { + const auto& data = static_cast<const ::arrow::PrimitiveArray&>(array); + const T* values = nullptr; + // The values buffer may be null if the array is empty (ARROW-2744) + if (data.values() != nullptr) { + values = reinterpret_cast<const T*>(data.values()->data()) + data.offset(); + } else { + DCHECK_EQ(data.length(), 0); + } + bool no_nulls = + this->descr()->schema_node()->is_required() || (array.null_count() == 0); + + if (!maybe_parent_nulls && no_nulls) { + PARQUET_CATCH_NOT_OK(WriteBatch(num_levels, def_levels, rep_levels, values)); Review Comment: This is the existing logic, I haven't changed it. I there are actually null values in the array not just being nullable, then we need to pick the slower path. -- 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