wecharyu commented on code in PR #48468:
URL: https://github.com/apache/arrow/pull/48468#discussion_r2691105502
##########
cpp/src/parquet/arrow/writer.cc:
##########
@@ -396,14 +396,19 @@ class FileWriterImpl : public FileWriter {
RETURN_NOT_OK(table.Validate());
if (chunk_size <= 0 && table.num_rows() > 0) {
- return Status::Invalid("chunk size per row_group must be greater than
0");
- } else if (!table.schema()->Equals(*schema_, false)) {
+ return Status::Invalid("rows per row_group must be greater than 0");
+ } else if (!table.schema()->Equals(*schema_, /*check_metadata=*/false)) {
return Status::Invalid("table schema does not match this writer's.
table:'",
table.schema()->ToString(), "' this:'",
schema_->ToString(),
"'");
} else if (chunk_size > this->properties().max_row_group_length()) {
chunk_size = this->properties().max_row_group_length();
}
+ if (auto avg_row_size = EstimateCompressedBytesPerRow()) {
+ chunk_size = std::min(
+ chunk_size,
static_cast<int64_t>(this->properties().max_row_group_bytes() /
+ avg_row_size.value()));
Review Comment:
The `chunk_size` could be 0 if the configured `max_row_group_bytes` is less
than `avg_row_size`, do we need a double check here?
--
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]