-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of storing these in the segment map, we could store these in the Array flatbuffer, and then can pass them into `SegmentReader::get(id, alignment)`. The problem with this is that it would require two round trips to load a FlatLayout. One to fetch the array flatbuffer, then we know the alignment of the data buffers, and then a second RT to fetch the data buffers. Unless of course we store data buffer alignment in the FlatLayout metadata? That could work actually... FLUP: move ArrayData flatbuffer into the IPC definition as an ArrayMessage. Move row_count out of ArrayParts. Open Questions: * Who should control / configure compression + encryption? I don't think this should be handled inside the segment writer, since it doesn't know what type of segment it is (data, flatbuffer, etc.). Instead, if the layouts themselves request encryption / compression, then we can configure different properties for different layouts. e.g. different encryption key for each column.
- Loading branch information
Showing
17 changed files
with
487 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,29 @@ | ||
use flatbuffers::{FlatBufferBuilder, Follow, WIPOffset}; | ||
use vortex_error::{vortex_err, VortexError}; | ||
use vortex_flatbuffers::{footer2 as fb, ReadFlatBuffer, WriteFlatBuffer}; | ||
use vortex_buffer::Alignment; | ||
use vortex_error::VortexError; | ||
use vortex_flatbuffers::footer2 as fb; | ||
|
||
/// The location of a segment within a Vortex file. | ||
#[derive(Clone, Debug)] | ||
pub(crate) struct Segment { | ||
pub(crate) offset: u64, | ||
pub(crate) length: usize, | ||
pub(crate) length: u32, | ||
pub(crate) alignment: Alignment, | ||
} | ||
|
||
impl WriteFlatBuffer for Segment { | ||
type Target<'a> = fb::Segment<'a>; | ||
|
||
fn write_flatbuffer<'fb>( | ||
&self, | ||
fbb: &mut FlatBufferBuilder<'fb>, | ||
) -> WIPOffset<Self::Target<'fb>> { | ||
fb::Segment::create( | ||
fbb, | ||
&fb::SegmentArgs { | ||
offset: self.offset, | ||
length: self.length as u64, | ||
}, | ||
) | ||
impl From<&Segment> for fb::Segment { | ||
fn from(value: &Segment) -> Self { | ||
fb::Segment::new(value.offset, value.length, value.alignment.exponent(), 0, 0) | ||
} | ||
} | ||
|
||
impl ReadFlatBuffer for Segment { | ||
type Source<'a> = fb::Segment<'a>; | ||
impl TryFrom<&fb::Segment> for Segment { | ||
type Error = VortexError; | ||
|
||
fn read_flatbuffer<'buf>( | ||
fb: &<Self::Source<'buf> as Follow<'buf>>::Inner, | ||
) -> Result<Self, Self::Error> { | ||
fn try_from(value: &fb::Segment) -> Result<Self, Self::Error> { | ||
Ok(Self { | ||
offset: fb.offset(), | ||
length: usize::try_from(fb.length()) | ||
.map_err(|_| vortex_err!("segment length exceeds maximum usize"))?, | ||
offset: value.offset(), | ||
length: value.length(), | ||
alignment: Alignment::from_exponent(value.alignment_exponent()), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.