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

Function WriteFullFile

cpp/examples/arrow/parquet_read_write.cc:102–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102arrow::Status WriteFullFile(std::string path_to_file) {
103 // #include "parquet/arrow/writer.h"
104 // #include "arrow/util/type_fwd.h"
105 using parquet::ArrowWriterProperties;
106 using parquet::WriterProperties;
107
108 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<arrow::Table> table, GetTable());
109
110 // Choose compression
111 std::shared_ptr<WriterProperties> props =
112 WriterProperties::Builder().compression(arrow::Compression::SNAPPY)->build();
113
114 // Opt to store Arrow schema for easier reads back into Arrow
115 std::shared_ptr<ArrowWriterProperties> arrow_props =
116 ArrowWriterProperties::Builder().store_schema()->build();
117
118 std::shared_ptr<arrow::io::FileOutputStream> outfile;
119 ARROW_ASSIGN_OR_RAISE(outfile, arrow::io::FileOutputStream::Open(path_to_file));
120
121 ARROW_RETURN_NOT_OK(
122 parquet::arrow::WriteTable(*table.get(), arrow::default_memory_pool(), outfile,
123 /*chunk_size=*/64 * 1024, props, arrow_props));
124 return arrow::Status::OK();
125}
126
127arrow::Status WriteInBatches(std::string path_to_file) {
128 // #include "parquet/arrow/writer.h"

Callers 1

RunExamplesFunction · 0.85

Calls 10

default_memory_poolFunction · 0.85
store_schemaMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
GetTableFunction · 0.70
BuilderFunction · 0.50
WriteTableFunction · 0.50
OKFunction · 0.50
buildMethod · 0.45
compressionMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected