jiaqizho commented on code in PR #1364:
URL: https://github.com/apache/cloudberry/pull/1364#discussion_r2419586060
##########
contrib/pax_storage/src/cpp/storage/pax.cc:
##########
@@ -280,14 +282,19 @@ void TableWriter::Open() {
// insert tuple into the aux table before inserting any tuples.
cbdb::InsertMicroPartitionPlaceHolder(RelationGetRelid(relation_),
current_blockno_);
+ cur_physical_size_ = 0;
}
void TableWriter::WriteTuple(TupleTableSlot *slot) {
Assert(writer_);
Assert(strategy_);
- // should check split strategy before write tuple
- // otherwise, may got a empty file in the disk
- if (strategy_->ShouldSplit(writer_->PhysicalSize(), num_tuples_)) {
+ // Sampled split check to reduce PhysicalSize() overhead
+ // We first perform a sampled pre-write check to avoid empty files.
+ if ((num_tuples_ % PAX_SPLIT_CHECK_INTERVAL) == 0) {
Review Comment:
should be?
```
if ((num_tuples_ % PAX_SPLIT_CHECK_INTERVAL) == 0) {
cur_physical_size_ = writer_->PhysicalSize();
if (strategy_->ShouldSplit(cur_physical_size_, num_tuples_)) {
...
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]