| 26 | namespace { |
| 27 | |
| 28 | std::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 | |
| 44 | std::shared_ptr<arrow::RecordBatch> GetArrowRecordBatch( |
| 45 | ::google::cloud::bigquery::storage::v1::ArrowRecordBatch const& |