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

Method WriteFile

cpp/src/parquet/arrow/index_test.cc:124–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122class 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_;

Callers

nothing calls this directly

Calls 11

ToParquetSchemaFunction · 0.85
CreateOutputStreamFunction · 0.85
default_memory_poolFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
MakeFunction · 0.50
schemaMethod · 0.45
getMethod · 0.45
WriteTableMethod · 0.45
CloseMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected