Skip to content

Commit 1600b75

Browse files
committed
move into new vortex-compressor crate
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com> clean up Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent c46bf8d commit 1600b75

File tree

34 files changed

+2571
-1070
lines changed

34 files changed

+2571
-1070
lines changed

Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ members = [
1212
"vortex-proto",
1313
"vortex-array",
1414
"vortex-tensor",
15+
"vortex-compressor",
1516
"vortex-btrblocks",
1617
"vortex-layout",
1718
"vortex-scan",
@@ -259,6 +260,7 @@ vortex-array = { version = "0.1.0", path = "./vortex-array", default-features =
259260
vortex-btrblocks = { version = "0.1.0", path = "./vortex-btrblocks", default-features = false }
260261
vortex-buffer = { version = "0.1.0", path = "./vortex-buffer", default-features = false }
261262
vortex-bytebool = { version = "0.1.0", path = "./encodings/bytebool", default-features = false }
263+
vortex-compressor = { version = "0.1.0", path = "./vortex-compressor", default-features = false }
262264
vortex-datafusion = { version = "0.1.0", path = "./vortex-datafusion", default-features = false }
263265
vortex-datetime-parts = { version = "0.1.0", path = "./encodings/datetime-parts", default-features = false }
264266
vortex-decimal-byte-parts = { version = "0.1.0", path = "encodings/decimal-byte-parts", default-features = false }

fuzz/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use vortex_array::search_sorted::SearchSorted;
6161
use vortex_array::search_sorted::SearchSortedSide;
6262
use vortex_btrblocks::BtrBlocksCompressor;
6363
use vortex_btrblocks::BtrBlocksCompressorBuilder;
64-
use vortex_btrblocks::Scheme;
64+
use vortex_btrblocks::SchemeExt;
6565
use vortex_btrblocks::compressor::float;
6666
use vortex_btrblocks::compressor::integer;
6767
use vortex_btrblocks::compressor::string;

vortex-btrblocks/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tracing = { workspace = true }
2525
vortex-alp = { workspace = true }
2626
vortex-array = { workspace = true }
2727
vortex-buffer = { workspace = true }
28+
vortex-compressor = { workspace = true }
2829
vortex-datetime-parts = { workspace = true }
2930
vortex-decimal-byte-parts = { workspace = true }
3031
vortex-error = { workspace = true }

vortex-btrblocks/public-api.lock

Lines changed: 733 additions & 165 deletions
Large diffs are not rendered by default.

vortex-btrblocks/src/builder.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use vortex_utils::aliases::hash_set::HashSet;
77

88
use crate::BtrBlocksCompressor;
9+
use crate::CascadingCompressor;
910
use crate::Scheme;
11+
use crate::SchemeExt;
1012
use crate::SchemeId;
1113

1214
/// All available compression schemes.
@@ -38,6 +40,10 @@ pub const ALL_SCHEMES: &[&dyn Scheme] = &[
3840
&crate::compressor::float::RLE_FLOAT_SCHEME,
3941
#[cfg(feature = "pco")]
4042
&crate::compressor::float::PcoScheme,
43+
// Decimal schemes.
44+
&crate::compressor::decimal::DecimalScheme,
45+
// Temporal schemes.
46+
&crate::compressor::temporal::TemporalScheme,
4147
// String schemes.
4248
&crate::compressor::string::UncompressedScheme,
4349
&crate::compressor::string::DictScheme,
@@ -50,35 +56,31 @@ pub const ALL_SCHEMES: &[&dyn Scheme] = &[
5056
&crate::compressor::string::ZstdBuffersScheme,
5157
];
5258

53-
/// Schemes excluded by default (behind feature gates that are off or known-expensive).
54-
const DEFAULT_EXCLUDED: &[SchemeId] = &[
59+
/// Returns the set of scheme IDs excluded by default (behind feature gates or known-expensive).
60+
pub fn default_excluded() -> HashSet<SchemeId> {
61+
#[allow(unused_mut)]
62+
let mut excluded = HashSet::new();
5563
#[cfg(feature = "pco")]
56-
SchemeId {
57-
name: "vortex.int.pco",
58-
},
59-
#[cfg(feature = "pco")]
60-
SchemeId {
61-
name: "vortex.float.pco",
62-
},
64+
{
65+
excluded.insert(crate::compressor::integer::PcoScheme.id());
66+
excluded.insert(crate::compressor::float::PcoScheme.id());
67+
}
6368
#[cfg(feature = "zstd")]
64-
SchemeId {
65-
name: "vortex.string.zstd",
66-
},
69+
excluded.insert(crate::compressor::string::ZstdScheme.id());
6770
#[cfg(all(feature = "zstd", feature = "unstable_encodings"))]
68-
SchemeId {
69-
name: "vortex.string.zstd_buffers",
70-
},
71-
];
71+
excluded.insert(crate::compressor::string::ZstdBuffersScheme.id());
72+
excluded
73+
}
7274

7375
/// Builder for creating configured [`BtrBlocksCompressor`] instances.
7476
///
7577
/// Use this builder to configure which compression schemes are allowed.
76-
/// By default, all schemes are enabled except those in [`DEFAULT_EXCLUDED`].
78+
/// By default, all schemes are enabled except those in [`default_excluded`].
7779
///
7880
/// # Examples
7981
///
8082
/// ```rust
81-
/// use vortex_btrblocks::{BtrBlocksCompressorBuilder, Scheme};
83+
/// use vortex_btrblocks::{BtrBlocksCompressorBuilder, Scheme, SchemeExt};
8284
/// use vortex_btrblocks::compressor::integer::DictScheme;
8385
///
8486
/// // Default compressor - all non-excluded schemes allowed.
@@ -102,7 +104,7 @@ pub struct BtrBlocksCompressorBuilder {
102104

103105
impl Default for BtrBlocksCompressorBuilder {
104106
fn default() -> Self {
105-
let excluded: HashSet<SchemeId> = DEFAULT_EXCLUDED.iter().copied().collect();
107+
let excluded = default_excluded();
106108
Self {
107109
schemes: ALL_SCHEMES
108110
.iter()
@@ -150,6 +152,6 @@ impl BtrBlocksCompressorBuilder {
150152
.copied()
151153
.filter(|s| self.schemes.contains(s))
152154
.collect();
153-
BtrBlocksCompressor { schemes }
155+
BtrBlocksCompressor(CascadingCompressor::new(schemes))
154156
}
155157
}

0 commit comments

Comments
 (0)