| 122 | class TestingWithPageIndex { |
| 123 | public: |
| 124 | void WriteFile(const std::shared_ptr<WriterProperties>& writer_properties, |
| 125 | const std::shared_ptr<::arrow::Table>& table) { |
| 126 | // Get schema from table. |
| 127 | auto schema = table->schema(); |
| 128 | std::shared_ptr<SchemaDescriptor> parquet_schema; |
| 129 | auto arrow_writer_properties = default_arrow_writer_properties(); |
| 130 | ASSERT_OK_NO_THROW(ToParquetSchema(schema.get(), *writer_properties, |
| 131 | *arrow_writer_properties, &parquet_schema)); |
| 132 | auto schema_node = std::static_pointer_cast<GroupNode>(parquet_schema->schema_root()); |
| 133 | |
| 134 | // Write table to buffer. |
| 135 | auto sink = CreateOutputStream(); |
| 136 | auto pool = ::arrow::default_memory_pool(); |
| 137 | auto writer = ParquetFileWriter::Open(sink, schema_node, writer_properties); |
| 138 | std::unique_ptr<FileWriter> arrow_writer; |
| 139 | ASSERT_OK(FileWriter::Make(pool, std::move(writer), schema, arrow_writer_properties, |
| 140 | &arrow_writer)); |
| 141 | ASSERT_OK_NO_THROW(arrow_writer->WriteTable(*table)); |
| 142 | ASSERT_OK_NO_THROW(arrow_writer->Close()); |
| 143 | ASSERT_OK_AND_ASSIGN(buffer_, sink->Finish()); |
| 144 | } |
| 145 | |
| 146 | protected: |
| 147 | std::shared_ptr<Buffer> buffer_; |
nothing calls this directly
no test coverage detected