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

Function GetTable

cpp/examples/arrow/parquet_column_encryption.cc:33–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace ds = arrow::dataset;
32
33arrow::Result<std::shared_ptr<arrow::Table>> GetTable() {
34 const auto& int_type = arrow::int32();
35 auto struct_type = arrow::struct_({{"a", arrow::int32()}, {"b", arrow::int64()}});
36 auto map_type = arrow::map(arrow::int32(), arrow::utf8());
37 auto list_type = arrow::list(arrow::int32());
38
39 ARROW_ASSIGN_OR_RAISE(auto arr_i,
40 arrow::json::ArrayFromJSONString(int_type, "[1, 3, 5, 7, 1]"));
41 ARROW_ASSIGN_OR_RAISE(
42 auto arr_struct,
43 arrow::json::ArrayFromJSONString(
44 struct_type, "[[2, 20], [4, 40], [6, 60], [8, 80], [10, 100]]"));
45 ARROW_ASSIGN_OR_RAISE(
46 auto arr_map,
47 arrow::json::ArrayFromJSONString(
48 map_type,
49 R"([[[2, "2"], [4, "4"]], [[6, "6"]], [], [[8, "8"], [10, "10"]], null])"));
50 ARROW_ASSIGN_OR_RAISE(auto arr_list,
51 arrow::json::ArrayFromJSONString(
52 list_type, "[[1, 2, 3], [4, 5, 6], [7], [8], null]"));
53
54 auto schema = arrow::schema({
55 arrow::field("i", int_type),
56 arrow::field("s", struct_type),
57 arrow::field("m", map_type),
58 arrow::field("l", list_type),
59 });
60
61 return arrow::Table::Make(schema, {arr_i, arr_struct, arr_map, arr_list});
62}
63
64std::shared_ptr<parquet::encryption::CryptoFactory> GetCryptoFactory() {
65 // Configure KMS.

Callers 1

WriteEncryptedFileFunction · 0.70

Calls 6

struct_Function · 0.85
mapFunction · 0.85
listFunction · 0.85
schemaFunction · 0.50
fieldFunction · 0.50
MakeFunction · 0.50

Tested by

no test coverage detected