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

Function MakeDictionaryBatch

cpp/src/arrow/ipc/read_write_test.cc:1796–1813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1794 public ::testing::TestWithParam<MakeRecordBatch*> {};
1795
1796Status MakeDictionaryBatch(std::shared_ptr<RecordBatch>* out) {
1797 auto f0_type = arrow::dictionary(int32(), utf8());
1798 auto f1_type = arrow::dictionary(int8(), utf8());
1799
1800 auto dict = ArrayFromJSON(utf8(), "[\"foo\", \"bar\", \"baz\"]");
1801
1802 auto indices0 = ArrayFromJSON(int32(), "[1, 2, null, 0, 2, 0]");
1803 auto indices1 = ArrayFromJSON(int8(), "[0, 0, 2, 2, 1, 1]");
1804
1805 auto a0 = std::make_shared<DictionaryArray>(f0_type, indices0, dict);
1806 auto a1 = std::make_shared<DictionaryArray>(f1_type, indices1, dict);
1807
1808 // construct batch
1809 auto schema = ::arrow::schema({field("dict1", f0_type), field("dict2", f1_type)});
1810
1811 *out = RecordBatch::Make(schema, 6, {a0, a1});
1812 return Status::OK();
1813}
1814
1815// A utility that supports reading/writing record batches,
1816// and manually specifying dictionaries.

Callers 1

TESTFunction · 0.85

Calls 6

ArrayFromJSONFunction · 0.85
schemaFunction · 0.70
dictionaryFunction · 0.50
fieldFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected