| 142 | class SizeStatisticsRoundTripTest : public ::testing::Test { |
| 143 | public: |
| 144 | void WriteFile(SizeStatisticsLevel level, const std::shared_ptr<::arrow::Table>& table, |
| 145 | int max_row_group_length, int page_size, |
| 146 | int write_batch_size = DEFAULT_WRITE_BATCH_SIZE) { |
| 147 | auto writer_properties = WriterProperties::Builder() |
| 148 | .max_row_group_length(max_row_group_length) |
| 149 | ->data_pagesize(page_size) |
| 150 | ->max_rows_per_page(std::numeric_limits<int64_t>::max()) |
| 151 | ->write_batch_size(write_batch_size) |
| 152 | ->enable_write_page_index() |
| 153 | ->enable_statistics() |
| 154 | ->set_size_statistics_level(level) |
| 155 | ->build(); |
| 156 | |
| 157 | // Get schema from table. |
| 158 | auto schema = table->schema(); |
| 159 | std::shared_ptr<SchemaDescriptor> parquet_schema; |
| 160 | auto arrow_writer_properties = default_arrow_writer_properties(); |
| 161 | ASSERT_OK_NO_THROW(arrow::ToParquetSchema(schema.get(), *writer_properties, |
| 162 | *arrow_writer_properties, &parquet_schema)); |
| 163 | auto schema_node = |
| 164 | std::static_pointer_cast<schema::GroupNode>(parquet_schema->schema_root()); |
| 165 | |
| 166 | // Write table to buffer. |
| 167 | auto sink = CreateOutputStream(); |
| 168 | auto pool = ::arrow::default_memory_pool(); |
| 169 | auto writer = ParquetFileWriter::Open(sink, schema_node, writer_properties); |
| 170 | std::unique_ptr<arrow::FileWriter> arrow_writer; |
| 171 | ASSERT_OK(arrow::FileWriter::Make(pool, std::move(writer), schema, |
| 172 | arrow_writer_properties, &arrow_writer)); |
| 173 | ASSERT_OK_NO_THROW(arrow_writer->WriteTable(*table)); |
| 174 | ASSERT_OK_NO_THROW(arrow_writer->Close()); |
| 175 | ASSERT_OK_AND_ASSIGN(buffer_, sink->Finish()); |
| 176 | } |
| 177 | |
| 178 | void ReadSizeStatistics() { |
| 179 | auto read_properties = default_arrow_reader_properties(); |
nothing calls this directly
no test coverage detected