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