Skip to content

Commit bb05df0

Browse files
committed
zstdbuffers
Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>
1 parent d53301e commit bb05df0

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

benchmarks/datafusion-bench/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ custom-labels = { workspace = true }
4646

4747
[features]
4848
cuda = ["dep:vortex-cuda"]
49-
unstable_encodings = ["vortex/unstable_encodings"]
49+
unstable_encodings = ["vortex/unstable_encodings", "vortex-bench/unstable_encodings"]
5050

5151
[lints]
5252
workspace = true

benchmarks/duckdb-bench/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ vortex-duckdb = { workspace = true }
2727

2828
[features]
2929
cuda = ["dep:vortex-cuda"]
30-
unstable_encodings = ["vortex/unstable_encodings"]
30+
unstable_encodings = ["vortex/unstable_encodings", "vortex-bench/unstable_encodings"]
3131

3232
[lints]
3333
workspace = true

vortex-bench/src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,17 @@ pub enum CompactionStrategy {
234234
impl CompactionStrategy {
235235
pub fn apply_options(&self, options: VortexWriteOptions) -> VortexWriteOptions {
236236
match self {
237-
CompactionStrategy::Compact => options.with_strategy(
238-
WriteStrategyBuilder::default()
239-
.with_btrblocks_builder(BtrBlocksCompressorBuilder::default().with_compact())
240-
.build(),
241-
),
237+
CompactionStrategy::Compact => {
238+
#[cfg(feature = "unstable_encodings")]
239+
let btrblocks = BtrBlocksCompressorBuilder::default().with_compact_buffers();
240+
#[cfg(not(feature = "unstable_encodings"))]
241+
let btrblocks = BtrBlocksCompressorBuilder::default().with_compact();
242+
options.with_strategy(
243+
WriteStrategyBuilder::default()
244+
.with_btrblocks_builder(btrblocks)
245+
.build(),
246+
)
247+
}
242248
CompactionStrategy::Default => options,
243249
}
244250
}

vortex-btrblocks/src/builder.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ impl BtrBlocksCompressorBuilder {
161161
builder
162162
}
163163

164+
/// Same as with_compact() but ZstdBuffers is used instead of Zstd
165+
#[cfg(all(feature = "zstd", feature = "unstable_encodings"))]
166+
pub fn with_compact_buffers(self) -> Self {
167+
let builder = self
168+
.with_new_scheme(&string::ZstdBuffersScheme)
169+
.with_new_scheme(&binary::ZstdBuffersScheme);
170+
171+
#[cfg(feature = "pco")]
172+
let builder = builder
173+
.with_new_scheme(&integer::PcoScheme)
174+
.with_new_scheme(&float::PcoScheme);
175+
176+
builder
177+
}
178+
164179
/// Excludes schemes without CUDA kernel support and adds Zstd for string and binary compression.
165180
///
166181
/// With the `unstable_encodings` feature, buffer-level Zstd compression is used which

0 commit comments

Comments
 (0)