MCPcopy Create free account
hub / github.com/apache/arrow / WriteArrowSerialize

Method WriteArrowSerialize

cpp/src/parquet/column_writer.cc:2109–2135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2107template <typename ParquetType>
2108template <typename ArrowType>
2109Status TypedColumnWriterImpl<ParquetType>::WriteArrowSerialize(
2110 const int16_t* def_levels, const int16_t* rep_levels, int64_t num_levels,
2111 const ::arrow::Array& array, ArrowWriteContext* ctx, bool maybe_parent_nulls) {
2112 using ArrayType = typename ::arrow::TypeTraits<ArrowType>::ArrayType;
2113 using ParquetCType = typename ParquetType::c_type;
2114
2115 ParquetCType* buffer = nullptr;
2116 PARQUET_THROW_NOT_OK(ctx->GetScratchData<ParquetCType>(array.length(), &buffer));
2117
2118 SerializeFunctor<ParquetType, ArrowType> functor;
2119 // The value buffer could be empty if all values are nulls.
2120 // The output buffer will then remain uninitialized, but that's ok since
2121 // null value slots are not written in Parquet.
2122 if (array.null_count() != array.length()) {
2123 RETURN_NOT_OK(functor.Serialize(checked_cast<const ArrayType&>(array), ctx, buffer));
2124 }
2125 bool no_nulls =
2126 this->descr()->schema_node()->is_required() || (array.null_count() == 0);
2127 if (!maybe_parent_nulls && no_nulls) {
2128 PARQUET_CATCH_NOT_OK(WriteBatchInternal(num_levels, def_levels, rep_levels, buffer));
2129 } else {
2130 PARQUET_CATCH_NOT_OK(WriteBatchSpacedInternal(num_levels, def_levels, rep_levels,
2131 array.null_bitmap_data(),
2132 array.offset(), buffer));
2133 }
2134 return Status::OK();
2135}
2136
2137#define WRITE_SERIALIZE_CASE(ArrowEnum) \
2138 case ::arrow::Type::ArrowEnum: { \

Callers

nothing calls this directly

Calls 6

descrMethod · 0.95
OKFunction · 0.50
lengthMethod · 0.45
null_countMethod · 0.45
SerializeMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected