benibus commented on code in PR #15194:
URL: https://github.com/apache/arrow/pull/15194#discussion_r1089371106
##########
cpp/src/arrow/ipc/writer.cc:
##########
@@ -176,19 +176,43 @@ class RecordBatchSerializer {
field_nodes_, buffer_meta_, options_,
&out_->metadata);
}
+ bool ShouldCompress(int64_t uncompressed_size, int64_t compressed_size)
const {
+ auto max_compressed_size = static_cast<int64_t>(
+ std::floor((1.0 - options_.min_space_savings) * uncompressed_size));
+ return compressed_size <= max_compressed_size;
Review Comment:
You're right, that isn't taken into account here.
My only issue is that you'd lose the ability to easily say "only compress if
doing so wouldn't be strictly counterproductive", which seems like a fairly
common/sensible constraint. Instead, one would need to specify an arbitrary
non-zero value to get that behavior.
I suspect that using `std::optional` was the better choice after all. I
hadn't fully consider this edge-case before suggesting its removal.
--
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]