SteNicholas commented on code in PR #1480:
URL: https://github.com/apache/paimon-rust/pull/1480#discussion_r4658296885


##########
crates/paimon/src/table/compact/primary_key/lookup.rs:
##########
@@ -359,13 +356,13 @@ impl MergeFunction for LookupChangelogMergeFunction {
             }
             _ => {}
         }
-        let changelog = if changes.is_empty() {
-            None
-        } else {
-            Some(
+        let changelog = match changes.len() {
+            0 => None,
+            1 => changes.pop(),

Review Comment:
   **Materialize a lone changelog row before handing it to the writer.** When 
the merge emits exactly one change, `changelog_batch` calls Arrow’s 
`concat_batches` with one input. Arrow slices each column again, so 
`ResourceFormatWriter` charges the full source allocation through 
`get_array_memory_size()`.
   
   I reproduced this with `read.batch-size=128`, 127 superseded 4 KiB strings, 
and one new key with a one-byte value in the same ORC batch. With a 64 KiB 
memory limit, the parent completes with a peak reservation of 4,115 bytes. This 
commit requests 523,262 bytes for that single changelog row and fails with 
`ResourceExhausted`. Could we detach the row on a singleton flush and cover 
this case with a memory-limited compaction test?



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