| 1227 | } |
| 1228 | |
| 1229 | Status ToParquetSchema(const ::arrow::Schema* arrow_schema, |
| 1230 | const WriterProperties& properties, |
| 1231 | const ArrowWriterProperties& arrow_properties, |
| 1232 | std::shared_ptr<SchemaDescriptor>* out) { |
| 1233 | std::vector<NodePtr> nodes(arrow_schema->num_fields()); |
| 1234 | for (int i = 0; i < arrow_schema->num_fields(); i++) { |
| 1235 | RETURN_NOT_OK( |
| 1236 | FieldToNode(arrow_schema->field(i), properties, arrow_properties, &nodes[i])); |
| 1237 | } |
| 1238 | |
| 1239 | NodePtr schema = GroupNode::Make("schema", Repetition::REQUIRED, nodes); |
| 1240 | *out = std::make_shared<::parquet::SchemaDescriptor>(); |
| 1241 | PARQUET_CATCH_NOT_OK((*out)->Init(schema)); |
| 1242 | |
| 1243 | return Status::OK(); |
| 1244 | } |
| 1245 | |
| 1246 | Status ToParquetSchema(const ::arrow::Schema* arrow_schema, |
| 1247 | const WriterProperties& properties, |