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

Method Close

cpp/src/parquet/file_writer.cc:359–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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