-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial version of simple FileReader/Writer #516
Conversation
let len = chunk.byte_offsets.len() - 1; | ||
let byte_counts = chunk | ||
.byte_offsets | ||
.iter() | ||
.skip(1) | ||
.zip(chunk.byte_offsets.iter()) | ||
.map(|(a, b)| a - b) | ||
.collect_vec(); | ||
|
||
chunks.extend( | ||
chunk | ||
.byte_offsets | ||
.iter() | ||
.zip(chunk.byte_offsets.iter().skip(1)) | ||
.map(|(begin, end)| Layout::Flat(FlatLayout::new(*begin, *end))), | ||
); | ||
let row_counts = chunk | ||
.row_offsets | ||
.iter() | ||
.skip(1) | ||
.zip(chunk.row_offsets.iter()) | ||
.map(|(a, b)| a - b) | ||
.collect_vec(); | ||
chunk.byte_offsets.truncate(len); | ||
chunk.row_offsets.truncate(len); | ||
|
||
let metadata_array = StructArray::try_new( | ||
[ | ||
"byte_offset".into(), | ||
"byte_count".into(), | ||
"row_offset".into(), | ||
"row_count".into(), | ||
] | ||
.into(), | ||
vec![ | ||
chunk.byte_offsets.into_array(), | ||
byte_counts.into_array(), | ||
chunk.row_offsets.into_array(), | ||
row_counts.into_array(), | ||
], | ||
len, | ||
Validity::NonNullable, | ||
)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic beyond extending chunks byte offsets is highly suspect. We can't reuse these tables in ChunkedArrayReader which is a bad thing. I wonder if we need to store multiple metadata tables since the offset tables are going to be 1 row longer than stat tables. OR the byte/row offsets live in layouts and these tables are pure metadata.
note that the new vortex_serde tests appear to take a LOOONG time in miri, probably worth adding |
Reader currently assumes Chunked(Column(Chunked)) layouts. This is going to be expanded in follow ups