-
Notifications
You must be signed in to change notification settings - Fork 25
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
More docs #1104
More docs #1104
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#[cfg(test)] | ||
mod assertions; | ||
|
||
mod bool; | ||
mod chunked; | ||
mod constant; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,10 @@ pub trait ArrayDef { | |
type Encoding: ArrayEncoding + ArrayEncodingExt<D = Self>; | ||
} | ||
|
||
/// Macro to generate all the necessary code for a new type of array encoding. Including: | ||
/// 1. New Array type that implements `AsRef<Array>`, `GetArrayMetadata`, `ToArray`, `IntoArray`, and multiple useful `From`/`TryFrom` implementations. | ||
/// 1. New Encoding type that implements `ArrayEncoding`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Numbering is 1, 1, 1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Markdown auto-generates the right numbers There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. + makes it easier to re-order/add more points (checked both VSCode and rustdoc renders it correctly) |
||
/// 1. New metadata type that implements `ArrayMetadata`. | ||
#[macro_export] | ||
macro_rules! impl_encoding { | ||
($id:literal, $code:expr, $Name:ident) => { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,7 +12,6 @@ | |||||
use std::fmt::{Debug, Display, Formatter}; | ||||||
use std::future::ready; | ||||||
|
||||||
pub use ::paste; | ||||||
pub use canonical::*; | ||||||
pub use context::*; | ||||||
pub use data::*; | ||||||
|
@@ -62,9 +61,14 @@ pub mod flatbuffers { | |||||
pub use vortex_flatbuffers::array::*; | ||||||
} | ||||||
|
||||||
/// A central type for all Vortex arrays, which are known length sequences of compressed data. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/// | ||||||
/// This is the main entrypoint for working with in-memory Vortex data, and dispatches work over the underlying encoding or memory representations. | ||||||
#[derive(Debug, Clone)] | ||||||
pub enum Array { | ||||||
/// Owned [`Array`] with serialized metadata, backed by heap-allocated memory. | ||||||
Data(ArrayData), | ||||||
/// Zero-copy view over flatbuffer-encoded [`Array`] data, created without eager serialization. | ||||||
View(ArrayView), | ||||||
} | ||||||
|
||||||
|
@@ -76,6 +80,7 @@ impl Array { | |||||
} | ||||||
} | ||||||
|
||||||
/// Returns the number of logical elements in the array. | ||||||
#[allow(clippy::same_name_method)] | ||||||
pub fn len(&self) -> usize { | ||||||
match self { | ||||||
|
@@ -91,6 +96,7 @@ impl Array { | |||||
} | ||||||
} | ||||||
|
||||||
/// Total size of the array in bytes, including all children and buffers. | ||||||
pub fn nbytes(&self) -> usize { | ||||||
self.with_dyn(|a| a.nbytes()) | ||||||
} | ||||||
|
@@ -102,13 +108,15 @@ impl Array { | |||||
} | ||||||
} | ||||||
|
||||||
/// Returns a Vec of Arrays with all of the array's child arrays. | ||||||
pub fn children(&self) -> Vec<Array> { | ||||||
match self { | ||||||
Array::Data(d) => d.children().iter().cloned().collect_vec(), | ||||||
Array::View(v) => v.children(), | ||||||
} | ||||||
} | ||||||
|
||||||
/// Returns the number of child arrays | ||||||
pub fn nchildren(&self) -> usize { | ||||||
match self { | ||||||
Self::Data(d) => d.nchildren(), | ||||||
|
@@ -174,7 +182,7 @@ impl Array { | |||||
) | ||||||
} | ||||||
|
||||||
/// Checks whether array is of given encoding | ||||||
/// Checks whether array is of a given encoding. | ||||||
pub fn is_encoding(&self, id: EncodingId) -> bool { | ||||||
self.encoding().id() == id | ||||||
} | ||||||
|
@@ -270,6 +278,7 @@ pub trait ArrayTrait: | |||||
+ ArrayStatisticsCompute | ||||||
+ ToArrayData | ||||||
{ | ||||||
/// Total size of the array in bytes, including all children and buffers. | ||||||
fn nbytes(&self) -> usize { | ||||||
let mut visitor = NBytesVisitor(0); | ||||||
self.accept(&mut visitor) | ||||||
|
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.