fresh-borzoni commented on code in PR #443:
URL: https://github.com/apache/fluss-rust/pull/443#discussion_r2963459117


##########
crates/fluss/src/record/arrow.rs:
##########
@@ -156,9 +165,24 @@ pub struct MemoryLogRecordsArrowBuilder {
     arrow_record_batch_builder: Box<dyn ArrowRecordBatchInnerBuilder>,
     is_closed: bool,
     arrow_compression_info: ArrowCompressionInfo,
+    /// Effective write limit in bytes (after applying BUFFER_USAGE_RATIO).
+    write_limit: usize,
+    /// Pre-computed Arrow IPC overhead (metadata + body framing) for this 
schema.
+    /// Constant per schema+compression combination.
+    ipc_overhead: usize,
+    /// Estimated record count at which the next byte-size check should occur.
+    /// 0 means "unknown — check on the next append". Updated dynamically to
+    /// skip expensive `estimated_size_in_bytes()` calls on every append.
+    estimated_max_records_count: Cell<usize>,
+    /// Compression ratio estimator shared across batches for the same table.
+    compression_ratio_estimator: Arc<ArrowCompressionRatioEstimator>,
+    /// Snapshot of the compression ratio at batch creation time.
+    /// Matching Java's `ArrowWriter.estimatedCompressionRatio` which is
+    /// cached per batch and only refreshed on `reset()`.
+    estimated_compression_ratio: f32,
 }
 
-pub trait ArrowRecordBatchInnerBuilder: Send + Sync {
+pub trait ArrowRecordBatchInnerBuilder: Send {

Review Comment:
   I use Cell<i32> for the fullness threshold (needs interior mutability 
because is_full() takes &self). Cell is !Sync, so the trait bound had to drop 
Sync.
   This is safe because the builder lives behind a parking_lot::Mutex which 
only requires Send - one thread accesses it at a time. It's more correct Bound.



-- 
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]

Reply via email to