| 263 | } |
| 264 | |
| 265 | Status 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 | |
| 288 | Result<std::shared_ptr<ChunkedArray>> ViewOrCastChunkedArray( |
| 289 | const std::shared_ptr<ChunkedArray>& array, MemoryPool* pool, |
no test coverage detected