tustvold commented on code in PR #4280:
URL: https://github.com/apache/arrow-rs/pull/4280#discussion_r1205525959
##########
parquet/src/arrow/arrow_writer/mod.rs:
##########
@@ -284,156 +247,271 @@ impl<W: Write> RecordBatchWriter for ArrowWriter<W> {
}
}
-fn write_leaves<W: Write>(
- row_group_writer: &mut SerializedRowGroupWriter<'_, W>,
- arrays: &[ArrayRef],
- levels: &mut [Vec<LevelInfo>],
-) -> Result<()> {
- assert_eq!(arrays.len(), levels.len());
- assert!(!arrays.is_empty());
-
- let data_type = arrays.first().unwrap().data_type().clone();
- assert!(arrays.iter().all(|a| a.data_type() == &data_type));
-
- match &data_type {
- ArrowDataType::Null
- | ArrowDataType::Boolean
- | ArrowDataType::Int8
- | ArrowDataType::Int16
- | ArrowDataType::Int32
- | ArrowDataType::Int64
- | ArrowDataType::UInt8
- | ArrowDataType::UInt16
- | ArrowDataType::UInt32
- | ArrowDataType::UInt64
- | ArrowDataType::Float32
- | ArrowDataType::Float64
- | ArrowDataType::Timestamp(_, _)
- | ArrowDataType::Date32
- | ArrowDataType::Date64
- | ArrowDataType::Time32(_)
- | ArrowDataType::Time64(_)
- | ArrowDataType::Duration(_)
- | ArrowDataType::Interval(_)
- | ArrowDataType::Decimal128(_, _)
- | ArrowDataType::Decimal256(_, _)
- | ArrowDataType::FixedSizeBinary(_) => {
- let mut col_writer = row_group_writer.next_column()?.unwrap();
- for (array, levels) in arrays.iter().zip(levels.iter_mut()) {
- write_leaf(col_writer.untyped(), array,
levels.pop().expect("Levels exhausted"))?;
+/// A list of [`Bytes`] comprising a single column chunk
+#[derive(Default)]
+struct ArrowColumnChunk {
+ length: usize,
+ data: Vec<Bytes>,
+}
+
+impl Length for ArrowColumnChunk {
+ fn len(&self) -> u64 {
+ self.length as _
+ }
+}
+
+impl ChunkReader for ArrowColumnChunk {
+ type T = ChainReader;
+
+ fn get_read(&self, start: u64) -> Result<Self::T> {
+ assert_eq!(start, 0);
Review Comment:
We are somewhat relying on an implementation detail of append_column, but
given this is the same crate, I think it is fine. It will break noisily should
we change it
--
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]