Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Jul 10, 2024
1 parent db86bbe commit 69b8a64
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
29 changes: 14 additions & 15 deletions vortex-array/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@ impl Context {
impl Default for Context {
fn default() -> Self {
Self {
encodings: HashMap::from_iter(
[
&BoolEncoding as EncodingRef,
&ChunkedEncoding,
&ConstantEncoding,
&ExtensionEncoding,
&PrimitiveEncoding,
&SparseEncoding,
&StructEncoding,
&VarBinEncoding,
&VarBinViewEncoding,
]
.into_iter()
.map(|e| (e.id().code(), e)),
),
encodings: [
&BoolEncoding as EncodingRef,
&ChunkedEncoding,
&ConstantEncoding,
&ExtensionEncoding,
&PrimitiveEncoding,
&SparseEncoding,
&StructEncoding,
&VarBinEncoding,
&VarBinViewEncoding,
]
.into_iter()
.map(|e| (e.id().code(), e))
.collect(),
}
}
}
9 changes: 8 additions & 1 deletion vortex-array/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ use crate::canonical::{Canonical, IntoCanonical};
use crate::ArrayDef;
use crate::{Array, ArrayTrait};

// TODO(robert): Outline how you create a well known encoding id
/// EncodingId is a unique name and numerical code of the array
///
/// 0x0000 - reserved marker encoding
/// 0x0001 - 0x04FF - vortex internal encodings
/// 0x0401 - 0x7FFF - well known extension encodings
/// 0x8000 - 0xFFFF - custom extension encodings
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct EncodingId(&'static str, u16);

Expand All @@ -22,7 +29,7 @@ impl EncodingId {

impl Display for EncodingId {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Display::fmt(self.0, f)
write!(f, "{}({:#04x})", self.0, self.1)
}
}

Expand Down

0 comments on commit 69b8a64

Please sign in to comment.