| 1141 | } |
| 1142 | |
| 1143 | Status 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 | |
| 1165 | namespace { |
| 1166 |
nothing calls this directly
no test coverage detected