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

Function MakeStatisticsArray

cpp/src/arrow/record_batch_test.cc:1350–1481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1348}
1349
1350Result<std::shared_ptr<Array>> MakeStatisticsArray(
1351 const std::string& columns_json,
1352 const std::vector<std::vector<std::string>>& nested_statistics_keys,
1353 const std::vector<std::vector<ArrayStatistics::ValueType>>& nested_statistics_values,
1354 const std::vector<std::shared_ptr<DataType>>& array_types = {}) {
1355 auto columns_type = int32();
1356 auto columns_array = ArrayFromJSON(columns_type, columns_json);
1357 const auto n_columns = columns_array->length();
1358
1359 // nested_statistics_keys:
1360 // {
1361 // {"ARROW:row_count:exact", "ARROW:null_count:exact"},
1362 // {"ARROW:max_value:exact"},
1363 // {"ARROW:max_value:exact", "ARROW:distinct_count:exact"},
1364 // }
1365 // nested_statistics_values:
1366 // {
1367 // {int64_t{29}, int64_t{1}},
1368 // {double{2.9}},
1369 // {double{-2.9}, int64_t{2}},
1370 // }
1371 // ->
1372 // keys_dictionary:
1373 // {
1374 // "ARROW:row_count:exact",
1375 // "ARROW:null_count:exact",
1376 // "ARROW:max_value:exact",
1377 // "ARROW:distinct_count:exact",
1378 // }
1379 // keys_indices: {0, 1, 2, 2, 3}
1380 // values_types: {int64(), float64()}
1381 // values_type_codes: {0, 1}
1382 // values_values[0]: {int64_t{29}, int64_t{1}, int64_t{2}}
1383 // values_values[1]: {double{2.9}, double{-2.9}}
1384 // values_value_type_ids: {0, 0, 1, 1, 0}
1385 // values_value_offsets: {0, 1, 0, 1, 2}
1386 // statistics_offsets: {0, 2, 3, 5, 5}
1387 std::vector<std::string> keys_dictionary;
1388 std::vector<int32_t> keys_indices;
1389 std::vector<std::shared_ptr<DataType>> values_types;
1390 std::vector<int8_t> values_type_codes;
1391 std::vector<std::vector<ArrayStatistics::ValueType>> values_values;
1392 std::vector<int8_t> values_value_type_ids;
1393 std::vector<int32_t> values_value_offsets;
1394 std::vector<int32_t> statistics_offsets;
1395
1396 int32_t offset = 0;
1397 std::vector<int32_t> values_value_offset_counters;
1398 for (size_t i = 0; i < nested_statistics_keys.size(); ++i) {
1399 const auto& statistics_keys = nested_statistics_keys[i];
1400 const auto& statistics_values = nested_statistics_values[i];
1401 const auto& array_type = (i < array_types.size()) ? array_types[i] : null();
1402 statistics_offsets.push_back(offset);
1403 for (size_t j = 0; j < statistics_keys.size(); ++j) {
1404 const auto& key = statistics_keys[j];
1405 const auto& value = statistics_values[j];
1406 ++offset;
1407

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