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

Function ByteArrayStatisticsAsScalars

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

Source from the content-addressed store, hash-verified

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