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


##########
parquet/src/column/writer/mod.rs:
##########
@@ -314,6 +314,54 @@ impl<T: Default> ColumnMetrics<T> {
     }
 }
 
+/// Borrowed view of level data, analogous to `&str` for `LevelData`'s 
`String`.
+///
+/// This type exists so that [`GenericColumnWriter::write_batch_internal`] can 
accept
+/// level data from two callers without allocating: the public 
[`GenericColumnWriter::write_batch`]
+/// API wraps caller-provided `&[i16]` slices directly as `Materialized`, 
while the Arrow
+/// writer path converts owned `LevelData` via `.as_ref()` (which may also 
produce `Uniform`).
+#[derive(Debug, Clone, Copy)]
+pub(crate) enum LevelDataRef<'a> {

Review Comment:
   This is intentional: `LevelData` lives in the Arrow level builder, but 
`GenericColumnWriter::write_batch_internal` needs the borrowed representation 
for both Arrow-owned `LevelData` and the public non-Arrow `write_batch` API 
that receives `&[i16]`. Putting `LevelDataRef` next to `LevelData` would make 
`column::writer` depend upward on the Arrow writer module.



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