HippoBaro commented on code in PR #9653:
URL: https://github.com/apache/arrow-rs/pull/9653#discussion_r3054274916


##########
parquet/src/arrow/arrow_writer/levels.rs:
##########
@@ -846,6 +927,32 @@ impl ArrayLevels {
             max_rep_level: self.max_rep_level,
             array,
             logical_nulls,
+            uniform_levels: None,
+        }
+    }
+
+    /// If all levels are uniform (e.g., column is entirely null), returns
+    /// `(def_level_value, rep_level_value, count)` without materializing any 
Vec.
+    pub fn uniform_levels(&self) -> Option<(i16, i16, usize)> {
+        self.uniform_levels
+    }
+
+    /// Bulk-emit `count` uniform null def/rep levels. If the level Vecs are
+    /// still empty, stores a compact `uniform_levels` tuple instead of
+    /// materializing the Vecs. Otherwise falls back to extending them.
+    fn extend_uniform_null_levels(&mut self, def_val: i16, rep_val: i16, 
count: usize) {

Review Comment:
   Yep that was a footgun! The latest patch introduces a better state machine 
where transitions from uniform to dense is explicit:  appending a run with a 
different value to a `Uniform` automatically now materializes it into a vec 
first.



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