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

Function MakeUnionExtension

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

Source from the content-addressed store, hash-verified

1165namespace {
1166
1167Status MakeUnionExtension(const std::shared_ptr<DataType>& type,
1168 std::shared_ptr<RecordBatch>* out) {
1169 auto storage_type = checked_cast<const ExtensionType&>(*type).storage_type();
1170
1171 auto f0 = field("f0", type);
1172 auto f1 = field("f1", type, /*nullable=*/false);
1173 auto schema = ::arrow::schema({f0, f1});
1174
1175 auto a0 = ExtensionType::WrapArray(
1176 type, ArrayFromJSON(storage_type, R"([[0, 1.5], [1, null]])"));
1177 auto a1 = ExtensionType::WrapArray(
1178 type, ArrayFromJSON(storage_type, R"([[0, 1.5], [1, "abc"]])"));
1179
1180 *out = RecordBatch::Make(schema, a1->length(), {a0, a1});
1181 return Status::OK();
1182}
1183
1184} // namespace
1185

Callers 2

MakeDenseUnionExtensionFunction · 0.85
MakeSparseUnionExtensionFunction · 0.85

Calls 7

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