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

Function ByteArrayStatisticsAsScalars

cpp/src/parquet/arrow/reader_internal.cc:266–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266Status ByteArrayStatisticsAsScalars(const Statistics& statistics,
267 std::shared_ptr<::arrow::Scalar>* min,
268 std::shared_ptr<::arrow::Scalar>* max) {
269 auto logical_type = statistics.descr()->logical_type();
270 if (logical_type->type() == LogicalType::Type::DECIMAL) {
271 return ExtractDecimalMinMaxFromBytes(statistics.EncodeMin(), statistics.EncodeMax(),
272 *logical_type, min, max);
273 }
274 std::shared_ptr<::arrow::DataType> type;
275 if (statistics.descr()->physical_type() == Type::FIXED_LEN_BYTE_ARRAY) {
276 type = ::arrow::fixed_size_binary(statistics.descr()->type_length());
277 } else {
278 type = logical_type->type() == LogicalType::Type::STRING ? ::arrow::utf8()
279 : ::arrow::binary();
280 }
281 ARROW_ASSIGN_OR_RAISE(
282 *min, ::arrow::MakeScalar(type, Buffer::FromString(statistics.EncodeMin())));
283 ARROW_ASSIGN_OR_RAISE(
284 *max, ::arrow::MakeScalar(type, Buffer::FromString(statistics.EncodeMax())));
285
286 return Status::OK();
287}
288
289Result<std::shared_ptr<ChunkedArray>> ViewOrCastChunkedArray(
290 const std::shared_ptr<ChunkedArray>& array, MemoryPool* pool,

Callers 1

StatisticsAsScalarsFunction · 0.85

Calls 12

fixed_size_binaryFunction · 0.85
MakeScalarFunction · 0.85
FromStringFunction · 0.85
EncodeMinMethod · 0.80
EncodeMaxMethod · 0.80
physical_typeMethod · 0.80
type_lengthMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
descrMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected