MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cpp-samples / GetArrowSchema

Function GetArrowSchema

bigquery/read/arrow/arrow_read.cc:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace {
27
28std::shared_ptr<arrow::Schema> GetArrowSchema(
29 ::google::cloud::bigquery::storage::v1::ArrowSchema const& schema_in) {
30 std::shared_ptr<arrow::Buffer> buffer =
31 std::make_shared<arrow::Buffer>(schema_in.serialized_schema());
32 arrow::io::BufferReader buffer_reader(buffer);
33 arrow::ipc::DictionaryMemo dictionary_memo;
34 auto result = arrow::ipc::ReadSchema(&buffer_reader, &dictionary_memo);
35 if (!result.ok()) {
36 std::cout << "Unable to parse schema\n";
37 throw result.status();
38 }
39 std::shared_ptr<arrow::Schema> schema = result.ValueOrDie();
40 std::cout << std::format("Schema is:\n {}\n", schema->ToString());
41 return schema;
42}
43
44std::shared_ptr<arrow::RecordBatch> GetArrowRecordBatch(
45 ::google::cloud::bigquery::storage::v1::ArrowRecordBatch const&

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected