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

Function MakeDictExtension

cpp/src/arrow/ipc/test_common.cc:1143–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141}
1142
1143Status MakeDictExtension(std::shared_ptr<RecordBatch>* out) {
1144 auto type = dict_extension_type();
1145 auto storage_type = checked_cast<const ExtensionType&>(*type).storage_type();
1146
1147 auto f0 = field("f0", type);
1148 auto f1 = field("f1", type, /*nullable=*/false);
1149 auto schema = ::arrow::schema({f0, f1});
1150
1151 auto storage0 = std::make_shared<DictionaryArray>(
1152 storage_type, ArrayFromJSON(int8(), "[1, 0, null, 1, 1]"),
1153 ArrayFromJSON(utf8(), R"(["foo", "bar"])"));
1154 auto a0 = std::make_shared<ExtensionArray>(type, storage0);
1155
1156 auto storage1 = std::make_shared<DictionaryArray>(
1157 storage_type, ArrayFromJSON(int8(), "[2, 0, 0, 1, 1]"),
1158 ArrayFromJSON(utf8(), R"(["arrow", "parquet", "gandiva"])"));
1159 auto a1 = std::make_shared<ExtensionArray>(type, storage1);
1160
1161 *out = RecordBatch::Make(schema, a1->length(), {a0, a1});
1162 return Status::OK();
1163}
1164
1165namespace {
1166

Callers

nothing calls this directly

Calls 8

dict_extension_typeFunction · 0.85
ArrayFromJSONFunction · 0.85
storage_typeMethod · 0.80
schemaFunction · 0.70
fieldFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected