| 550 | } |
| 551 | |
| 552 | Result<std::unique_ptr<FileWriter>> FileWriter::Open( |
| 553 | const ::arrow::Schema& schema, ::arrow::MemoryPool* pool, |
| 554 | std::shared_ptr<::arrow::io::OutputStream> sink, |
| 555 | std::shared_ptr<WriterProperties> properties, |
| 556 | std::shared_ptr<ArrowWriterProperties> arrow_properties) { |
| 557 | std::shared_ptr<SchemaDescriptor> parquet_schema; |
| 558 | RETURN_NOT_OK( |
| 559 | ToParquetSchema(&schema, *properties, *arrow_properties, &parquet_schema)); |
| 560 | |
| 561 | auto schema_node = std::static_pointer_cast<GroupNode>(parquet_schema->schema_root()); |
| 562 | |
| 563 | std::shared_ptr<const KeyValueMetadata> metadata; |
| 564 | RETURN_NOT_OK(GetSchemaMetadata(schema, pool, *arrow_properties, &metadata)); |
| 565 | |
| 566 | std::unique_ptr<ParquetFileWriter> base_writer; |
| 567 | PARQUET_CATCH_NOT_OK(base_writer = ParquetFileWriter::Open(std::move(sink), schema_node, |
| 568 | std::move(properties), |
| 569 | std::move(metadata))); |
| 570 | |
| 571 | std::unique_ptr<FileWriter> writer; |
| 572 | auto schema_ptr = std::make_shared<::arrow::Schema>(schema); |
| 573 | RETURN_NOT_OK(Make(pool, std::move(base_writer), std::move(schema_ptr), |
| 574 | std::move(arrow_properties), &writer)); |
| 575 | |
| 576 | return writer; |
| 577 | } |
| 578 | |
| 579 | Status WriteFileMetaData(const FileMetaData& file_metadata, |
| 580 | ::arrow::io::OutputStream* sink) { |
nothing calls this directly
no test coverage detected