Skip to main content

reifydb_column/encoding/
compressed.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use reifydb_core::value::column::{
5	data::{Column, canonical::Canonical},
6	encoding::EncodingId,
7};
8use reifydb_type::Result;
9
10use crate::{compress::CompressConfig, encoding::Encoding};
11
12macro_rules! declare_compressed {
13	($ty:ident, $id:ident) => {
14		pub struct $ty;
15
16		impl $ty {
17			pub const ID: EncodingId = EncodingId::$id;
18		}
19
20		impl Encoding for $ty {
21			fn id(&self) -> EncodingId {
22				Self::ID
23			}
24
25			fn try_compress(&self, _input: &Canonical, _cfg: &CompressConfig) -> Result<Option<Column>> {
26				Ok(None)
27			}
28
29			fn canonicalize(&self, _array: &Column) -> Result<Canonical> {
30				todo!(concat!(stringify!($ty), "::canonicalize not yet implemented"))
31			}
32		}
33	};
34}
35
36declare_compressed!(ConstantEncoding, CONSTANT);
37declare_compressed!(AllNoneEncoding, ALL_NONE);
38declare_compressed!(DictEncoding, DICT);
39declare_compressed!(RleEncoding, RLE);
40declare_compressed!(DeltaEncoding, DELTA);
41declare_compressed!(DeltaRleEncoding, DELTA_RLE);
42declare_compressed!(ForEncoding, FOR);
43declare_compressed!(BitPackEncoding, BITPACK);
44declare_compressed!(SparseEncoding, SPARSE);