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

Function WriteRecordBatch

cpp/src/arrow/integration/json_internal.cc:2058–2077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2056}
2057
2058Status WriteRecordBatch(const RecordBatch& batch, RjWriter* writer) {
2059 writer->StartObject();
2060 writer->Key("count");
2061 writer->Int(static_cast<int32_t>(batch.num_rows()));
2062
2063 writer->Key("columns");
2064 writer->StartArray();
2065
2066 for (auto [column, i] : Zip(batch.columns(), Enumerate<int>)) {
2067 DCHECK_EQ(batch.num_rows(), column->length())
2068 << "Array length did not match record batch length: " << batch.num_rows()
2069 << " != " << column->length() << " " << batch.column_name(i);
2070
2071 RETURN_NOT_OK(WriteArray(batch.column_name(i), *column, writer));
2072 }
2073
2074 writer->EndArray();
2075 writer->EndObject();
2076 return Status::OK();
2077}
2078
2079Status WriteArray(const std::string& name, const Array& array, RjWriter* json_writer) {
2080 ArrayWriter converter(name, array, json_writer);

Callers 2

WriteRecordBatchMethod · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.70

Calls 12

ZipClass · 0.85
WriteArrayFunction · 0.85
columnsMethod · 0.80
OKFunction · 0.50
StartObjectMethod · 0.45
KeyMethod · 0.45
IntMethod · 0.45
num_rowsMethod · 0.45
StartArrayMethod · 0.45
lengthMethod · 0.45
EndArrayMethod · 0.45
EndObjectMethod · 0.45

Tested by

no test coverage detected