MCPcopy Create free account
hub / github.com/apache/arrow / WriteFile

Method WriteFile

cpp/src/parquet/size_statistics_test.cc:144–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142class 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();

Callers

nothing calls this directly

Calls 13

ToParquetSchemaFunction · 0.85
CreateOutputStreamFunction · 0.85
default_memory_poolFunction · 0.85
BuilderFunction · 0.70
MakeFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
buildMethod · 0.45
schemaMethod · 0.45
getMethod · 0.45
WriteTableMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected