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

Function MakeDictionaryBatch

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

Source from the content-addressed store, hash-verified

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