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

Method Close

cpp/src/parquet/file_writer.cc:351–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349 }
350
351 void Close() override {
352 if (is_open_) {
353 // If any functions here raise an exception, we set is_open_ to be false
354 // so that this does not get called again (possibly causing segfault)
355 is_open_ = false;
356 if (row_group_writer_) {
357 num_rows_ += row_group_writer_->num_rows();
358 row_group_writer_->Close();
359 }
360 row_group_writer_.reset();
361
362 // Per the Parquet spec, Bloom filter data can be stored either:
363 // 1) After all row groups (before page indexes), or
364 // 2) Between individual row groups.
365 // We choose option 1, which allows readers to coalesce I/Os when reading
366 // multiple Bloom filters sequentially.
367 WriteBloomFilter();
368 WritePageIndex();
369
370 // Write magic bytes and metadata
371 auto file_encryption_properties = properties_->file_encryption_properties();
372
373 if (file_encryption_properties == nullptr) { // Non encrypted file.
374 file_metadata_ = metadata_->Finish(key_value_metadata_);
375 WriteFileMetaData(*file_metadata_, sink_.get());
376 } else { // Encrypted file
377 CloseEncryptedFile(file_encryption_properties);
378 }
379 }
380 }
381
382 int num_columns() const override { return schema_.num_columns(); }
383

Callers

nothing calls this directly

Calls 6

WriteFileMetaDataFunction · 0.70
num_rowsMethod · 0.45
CloseMethod · 0.45
resetMethod · 0.45
FinishMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected