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

Function MakeStatisticsArray

cpp/src/arrow/record_batch_test.cc:1306–1437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304}
1305
1306Result<std::shared_ptr<Array>> MakeStatisticsArray(
1307 const std::string& columns_json,
1308 const std::vector<std::vector<std::string>>& nested_statistics_keys,
1309 const std::vector<std::vector<ArrayStatistics::ValueType>>& nested_statistics_values,
1310 const std::vector<std::shared_ptr<DataType>>& array_types = {}) {
1311 auto columns_type = int32();
1312 auto columns_array = ArrayFromJSON(columns_type, columns_json);
1313 const auto n_columns = columns_array->length();
1314
1315 // nested_statistics_keys:
1316 // {
1317 // {"ARROW:row_count:exact", "ARROW:null_count:exact"},
1318 // {"ARROW:max_value:exact"},
1319 // {"ARROW:max_value:exact", "ARROW:distinct_count:exact"},
1320 // }
1321 // nested_statistics_values:
1322 // {
1323 // {int64_t{29}, int64_t{1}},
1324 // {double{2.9}},
1325 // {double{-2.9}, int64_t{2}},
1326 // }
1327 // ->
1328 // keys_dictionary:
1329 // {
1330 // "ARROW:row_count:exact",
1331 // "ARROW:null_count:exact",
1332 // "ARROW:max_value:exact",
1333 // "ARROW:distinct_count:exact",
1334 // }
1335 // keys_indices: {0, 1, 2, 2, 3}
1336 // values_types: {int64(), float64()}
1337 // values_type_codes: {0, 1}
1338 // values_values[0]: {int64_t{29}, int64_t{1}, int64_t{2}}
1339 // values_values[1]: {double{2.9}, double{-2.9}}
1340 // values_value_type_ids: {0, 0, 1, 1, 0}
1341 // values_value_offsets: {0, 1, 0, 1, 2}
1342 // statistics_offsets: {0, 2, 3, 5, 5}
1343 std::vector<std::string> keys_dictionary;
1344 std::vector<int32_t> keys_indices;
1345 std::vector<std::shared_ptr<DataType>> values_types;
1346 std::vector<int8_t> values_type_codes;
1347 std::vector<std::vector<ArrayStatistics::ValueType>> values_values;
1348 std::vector<int8_t> values_value_type_ids;
1349 std::vector<int32_t> values_value_offsets;
1350 std::vector<int32_t> statistics_offsets;
1351
1352 int32_t offset = 0;
1353 std::vector<int32_t> values_value_offset_counters;
1354 for (size_t i = 0; i < nested_statistics_keys.size(); ++i) {
1355 const auto& statistics_keys = nested_statistics_keys[i];
1356 const auto& statistics_values = nested_statistics_values[i];
1357 const auto& array_type = (i < array_types.size()) ? array_types[i] : null();
1358 statistics_offsets.push_back(offset);
1359 for (size_t j = 0; j < statistics_keys.size(); ++j) {
1360 const auto& key = statistics_keys[j];
1361 const auto& value = statistics_values[j];
1362 ++offset;
1363

Callers

nothing calls this directly

Calls 13

ArrayFromJSONFunction · 0.85
dense_unionFunction · 0.85
mapFunction · 0.85
struct_Function · 0.85
push_backMethod · 0.80
emplace_backMethod · 0.80
dictionaryFunction · 0.70
fieldFunction · 0.70
lengthMethod · 0.45
sizeMethod · 0.45
EqualsMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected