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

Method Write

cpp/src/parquet/arrow/writer.cc:158–191  ·  view source on GitHub ↗

Writes out all leaf parquet columns to the RowGroupWriter that this object was constructed with. Each leaf column is written fully before the next column is written (i.e. no buffering is assumed). Columns are written in DFS order.

Source from the content-addressed store, hash-verified

156 //
157 // Columns are written in DFS order.
158 Status Write(ArrowWriteContext* ctx) {
159 for (int leaf_idx = 0; leaf_idx < leaf_count_; leaf_idx++) {
160 ColumnWriter* column_writer;
161 if (row_group_writer_->buffered()) {
162 const int column_index = start_leaf_column_index_ + leaf_idx;
163 PARQUET_CATCH_NOT_OK(column_writer = row_group_writer_->column(column_index));
164 } else {
165 PARQUET_CATCH_NOT_OK(column_writer = row_group_writer_->NextColumn());
166 }
167 for (auto& level_builder : level_builders_) {
168 RETURN_NOT_OK(level_builder->Write(
169 leaf_idx, ctx, [&](const MultipathLevelBuilderResult& result) {
170 size_t visited_component_size = result.post_list_visited_elements.size();
171 DCHECK_GT(visited_component_size, 0);
172 if (visited_component_size != 1) {
173 return Status::NotImplemented(
174 "Lists with non-zero length null components are not supported");
175 }
176 const ElementRange& range = result.post_list_visited_elements[0];
177 std::shared_ptr<Array> values_array =
178 result.leaf_array->Slice(range.start, range.Size());
179
180 return column_writer->WriteArrow(result.def_levels, result.rep_levels,
181 result.def_rep_level_count, *values_array,
182 ctx, result.leaf_is_nullable);
183 }));
184 }
185
186 if (!row_group_writer_->buffered()) {
187 PARQUET_CATCH_NOT_OK(column_writer->Close());
188 }
189 }
190 return Status::OK();
191 }
192
193 // Make a new object by converting each chunk in |data| to a MultipathLevelBuilder.
194 //

Callers 2

WriteColumnChunkMethod · 0.45
WriteRecordBatchMethod · 0.45

Calls 10

WriteArrowMethod · 0.80
NotImplementedFunction · 0.50
OKFunction · 0.50
bufferedMethod · 0.45
columnMethod · 0.45
NextColumnMethod · 0.45
sizeMethod · 0.45
SliceMethod · 0.45
SizeMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected