Skip to content

Commit 887bbc9

Browse files
authored
chore: rework LayoutBatchStream for legibility (#1245)
1. Expose `dtype` because all the callers want a dtype not a schema. 2. Avoid `vortex_expect` by storing known valid values in the StreamingState. 3. Use `mem::take` on the state to allow (2) to work.
1 parent 2ebf9eb commit 887bbc9

File tree

4 files changed

+220
-165
lines changed

4 files changed

+220
-165
lines changed

bench-vortex/benches/compress_noci.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn vortex_decompress_read(runtime: &Runtime, buf: Arc<Vec<u8>>) -> VortexResult<
134134
);
135135

136136
let stream = builder.build().await?;
137-
let dtype = stream.schema().clone().into();
137+
let dtype = stream.dtype().clone();
138138
let vecs: Vec<Array> = stream.try_collect().await?;
139139

140140
ChunkedArray::try_new(vecs, dtype).map(|e| e.into())

vortex-serde/src/layouts/read/mask.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ impl RowMask {
3838
Ok(Self { values, begin, end })
3939
}
4040

41-
/// Construct a RowMask from given bitmap and begin
41+
/// Construct a RowMask which is valid in the given range.
42+
pub fn new_valid_between(begin: usize, end: usize) -> Self {
43+
unsafe { RowMask::new_unchecked(Bitmap::from_range(0..(end - begin) as u32), begin, end) }
44+
}
45+
46+
/// Construct a RowMask from given bitmap and begin.
4247
///
4348
/// # Safety
4449
///

vortex-serde/src/layouts/read/recordbatchreader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ where
4040
stream: LayoutBatchStream<R>,
4141
runtime: &'a AR,
4242
) -> VortexResult<VortexRecordBatchReader<'a, R, AR>> {
43-
let arrow_schema = Arc::new(infer_schema(stream.schema().dtype())?);
43+
let arrow_schema = Arc::new(infer_schema(stream.dtype())?);
4444
Ok(VortexRecordBatchReader {
4545
stream,
4646
arrow_schema,

0 commit comments

Comments
 (0)