Skip to content
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

Merged
merged 48 commits into from
Jul 29, 2024
Merged

Initial version of simple FileReader/Writer #516

merged 48 commits into from
Jul 29, 2024

Conversation

robert3005
Copy link
Member

@robert3005 robert3005 commented Jul 24, 2024

Reader currently assumes Chunked(Column(Chunked)) layouts. This is going to be expanded in follow ups

Comment on lines +166 to +208
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,
)?;
Copy link
Member Author

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.

vortex-serde/src/file/file_reader.rs Outdated Show resolved Hide resolved
vortex-serde/src/file/file_reader.rs Outdated Show resolved Hide resolved
vortex-serde/src/file/file_writer.rs Outdated Show resolved Hide resolved
vortex-serde/src/io/read.rs Outdated Show resolved Hide resolved
vortex-serde/src/file/footer.rs Outdated Show resolved Hide resolved
vortex-serde/src/file/file_reader.rs Outdated Show resolved Hide resolved
vortex-serde/src/file/file_reader.rs Outdated Show resolved Hide resolved
@lwwmanning
Copy link
Member

note that the new vortex_serde tests appear to take a LOOONG time in miri, probably worth adding #[cfg_attr(miri, ignore)] those (and maybe making "fast" variants for miri to run)

@AdamGS AdamGS enabled auto-merge (squash) July 29, 2024 17:23
@AdamGS AdamGS disabled auto-merge July 29, 2024 17:23
@AdamGS AdamGS enabled auto-merge (squash) July 29, 2024 17:23
@AdamGS AdamGS merged commit 24dca82 into develop Jul 29, 2024
3 checks passed
@AdamGS AdamGS deleted the rk/metadata branch July 29, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants