-
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.
- Loading branch information
Showing
8 changed files
with
116 additions
and
49 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,6 +1,6 @@ | ||
pub mod file_reader; | ||
pub mod file_writer; | ||
mod footer; | ||
mod layouts; | ||
pub mod reader; | ||
|
||
pub const FULL_FOOTER_SIZE: usize = 20; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pub struct Projection { | ||
indices: Vec<usize>, | ||
} | ||
|
||
impl Projection { | ||
pub fn new(indices: impl AsRef<[usize]>) -> Self { | ||
Projection { | ||
indices: Vec::from(indices.as_ref()), | ||
} | ||
} | ||
|
||
pub fn indices(&self) -> &[usize] { | ||
self.indices.as_ref() | ||
} | ||
} | ||
|
||
impl From<Vec<usize>> for Projection { | ||
fn from(indices: Vec<usize>) -> Self { | ||
Self { indices } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use vortex_dtype::{FieldNames, StructDType}; | ||
use vortex_error::VortexResult; | ||
|
||
use super::projections::Projection; | ||
|
||
pub struct Schema(pub(crate) StructDType); | ||
|
||
impl Schema { | ||
pub fn fields(&self) -> &FieldNames { | ||
self.0.names() | ||
} | ||
|
||
pub fn project(&self, projection: Projection) -> VortexResult<Self> { | ||
self.0.project(projection.indices()).map(Self) | ||
} | ||
} |