| 398 | } |
| 399 | |
| 400 | RowGroupWriter* AppendRowGroup(bool buffered_row_group) { |
| 401 | if (row_group_writer_) { |
| 402 | num_rows_ += row_group_writer_->num_rows(); |
| 403 | row_group_writer_->Close(); |
| 404 | } |
| 405 | int16_t row_group_ordinal = -1; // row group ordinal not set |
| 406 | if (file_encryptor_ != nullptr) { |
| 407 | // Parquet thrifts using int16 for row group ordinal, so we can't have more than |
| 408 | // 32767 row groups in a file. |
| 409 | if (num_row_groups_ <= std::numeric_limits<int16_t>::max()) { |
| 410 | row_group_ordinal = static_cast<int16_t>(num_row_groups_); |
| 411 | } else { |
| 412 | throw ParquetException( |
| 413 | "Cannot write more than 32767 row groups in an encrypted file"); |
| 414 | } |
| 415 | } |
| 416 | num_row_groups_++; |
| 417 | auto rg_metadata = metadata_->AppendRowGroup(); |
| 418 | if (page_index_builder_) { |
| 419 | page_index_builder_->AppendRowGroup(); |
| 420 | } |
| 421 | if (bloom_filter_builder_) { |
| 422 | bloom_filter_builder_->AppendRowGroup(); |
| 423 | } |
| 424 | std::unique_ptr<RowGroupWriter::Contents> contents(new RowGroupSerializer( |
| 425 | sink_, rg_metadata, row_group_ordinal, properties_.get(), buffered_row_group, |
| 426 | file_encryptor_.get(), page_index_builder_.get(), bloom_filter_builder_.get(), |
| 427 | content_defined_chunkers_)); |
| 428 | row_group_writer_ = std::make_unique<RowGroupWriter>(std::move(contents)); |
| 429 | return row_group_writer_.get(); |
| 430 | } |
| 431 | |
| 432 | RowGroupWriter* AppendRowGroup() override { return AppendRowGroup(false); } |
| 433 |
nothing calls this directly
no test coverage detected