| 94 | |
| 95 | template <typename DType> |
| 96 | std::shared_ptr<Statistics> MakeTypedColumnStats(const format::ColumnMetaData& metadata, |
| 97 | const ColumnDescriptor* descr, |
| 98 | ::arrow::MemoryPool* pool) { |
| 99 | const auto& statistics = metadata.statistics; |
| 100 | const std::string kEmpty = ""; |
| 101 | const std::string* encoded_min = &kEmpty; |
| 102 | const std::string* encoded_max = &kEmpty; |
| 103 | bool has_min_max = false; |
| 104 | std::optional<bool> min_exact = std::nullopt; |
| 105 | std::optional<bool> max_exact = std::nullopt; |
| 106 | |
| 107 | switch (GetStatisticsMinMaxField(*descr)) { |
| 108 | case StatisticsMinMaxField::kMinValueMaxValue: |
| 109 | encoded_min = &statistics.min_value; |
| 110 | encoded_max = &statistics.max_value; |
| 111 | has_min_max = statistics.__isset.max_value && statistics.__isset.min_value; |
| 112 | min_exact = statistics.__isset.is_min_value_exact |
| 113 | ? std::optional<bool>(statistics.is_min_value_exact) |
| 114 | : std::nullopt; |
| 115 | max_exact = statistics.__isset.is_max_value_exact |
| 116 | ? std::optional<bool>(statistics.is_max_value_exact) |
| 117 | : std::nullopt; |
| 118 | break; |
| 119 | case StatisticsMinMaxField::kLegacyMinMax: |
| 120 | encoded_min = &statistics.min; |
| 121 | encoded_max = &statistics.max; |
| 122 | has_min_max = statistics.__isset.max && statistics.__isset.min; |
| 123 | break; |
| 124 | case StatisticsMinMaxField::kInvalid: |
| 125 | break; |
| 126 | } |
| 127 | |
| 128 | return MakeStatistics<DType>( |
| 129 | descr, *encoded_min, *encoded_max, metadata.num_values - statistics.null_count, |
| 130 | statistics.null_count, statistics.distinct_count, has_min_max, |
| 131 | statistics.__isset.null_count, statistics.__isset.distinct_count, min_exact, |
| 132 | max_exact, pool); |
| 133 | } |
| 134 | |
| 135 | std::shared_ptr<geospatial::GeoStatistics> MakeColumnGeometryStats( |
| 136 | const format::ColumnMetaData& metadata, const ColumnDescriptor* descr) { |
nothing calls this directly
no test coverage detected