Skip to content

Commit ffe45b2

Browse files
committed
Clean up imports and feature-gated scheme checks
Signed-off-by: Connor Tsui <[email protected]>
1 parent 8813bf5 commit ffe45b2

26 files changed

Lines changed: 113 additions & 94 deletions

File tree

‎benchmarks/compress-bench/src/gpu/vortex.rs‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ use vortex::array::VortexSessionExecute;
2323
use vortex::array::arrays::StructArray;
2424
use vortex::array::arrays::struct_::StructArrayExt;
2525
use vortex::compressor::BtrBlocksCompressor;
26+
use vortex::compressor::CompressionSessionExt;
27+
use vortex::editions::EditionSessionExt;
28+
use vortex::editions::EnabledEditions;
29+
use vortex::editions::cuda::CUDA_2026_09_0;
2630
use vortex::error::VortexResult;
2731
use vortex::file::OpenOptionsSessionExt;
32+
use vortex::file::VortexFile;
2833
use vortex::file::WriteOptionsSessionExt;
2934
use vortex::layout::layouts::chunked::writer::ChunkedLayoutStrategy;
3035
use vortex::layout::layouts::compressed::CompressingStrategy;
@@ -100,14 +105,10 @@ impl Compressor for GpuVortexCompressor {
100105
let strategy = Arc::new(ChunkedLayoutStrategy::new(CompressingStrategy::new(
101106
CudaFlatLayoutStrategy::default(),
102107
{
103-
let compression_session =
104-
vortex::compressor::CompressionSessionExt::fork_compression(&*SESSION);
105-
compression_session.register(vortex::editions::EnabledEditions::default());
106-
vortex::editions::EditionSessionExt::set_enabled_editions(
107-
&compression_session,
108-
[vortex::editions::cuda::CUDA_2026_09_0],
109-
)
110-
.expect("CUDA edition must be registered");
108+
let compression_session = CompressionSessionExt::fork_compression(&*SESSION);
109+
compression_session.register(EnabledEditions::default());
110+
EditionSessionExt::set_enabled_editions(&compression_session, [CUDA_2026_09_0])
111+
.expect("CUDA edition must be registered");
111112
BtrBlocksCompressor::from_session(&compression_session)
112113
},
113114
)));
@@ -174,7 +175,7 @@ impl Compressor for GpuVortexCompressor {
174175
/// Windows too, and the whole crate still has to compile on a developer's macOS machine. Asking
175176
/// for `--gpu-direct-io` where it cannot be honoured is an error rather than a silent no-op,
176177
/// because the flag changes what the resulting number means.
177-
async fn open_gpu(path: &Path, direct_io: bool) -> Result<vortex::file::VortexFile> {
178+
async fn open_gpu(path: &Path, direct_io: bool) -> Result<VortexFile> {
178179
let open_options = SESSION.open_options().with_cuda();
179180

180181
#[cfg(target_os = "linux")]

‎encodings/fastlanes/src/schemes/mod.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use vortex_compressor::scheme::AncestorExclusion;
1919
use vortex_compressor::scheme::ChildSelection;
2020
use vortex_compressor::scheme::DescendantExclusion;
2121
use vortex_compressor::scheme::SchemeExt;
22+
use vortex_compressor::scheme::SchemeId;
2223
use vortex_compressor::session::CompressionSessionExt;
2324

2425
/// Shared descendant exclusion rules for RLE schemes.
@@ -38,7 +39,7 @@ fn rle_descendant_exclusions() -> Vec<DescendantExclusion> {
3839
// children: ChildSelection::Many(&[1, 2]),
3940
// },
4041
DescendantExclusion {
41-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.sparse"),
42+
excluded: SchemeId::new("vortex.int.sparse"),
4243
children: ChildSelection::Many(&[1, 2]),
4344
},
4445
]

‎encodings/runend/src/schemes/runend.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use vortex_compressor::scheme::DescendantExclusion;
2424
use vortex_compressor::scheme::EstimateVerdict;
2525
use vortex_compressor::scheme::Scheme;
2626
use vortex_compressor::scheme::SchemeExt;
27+
use vortex_compressor::scheme::SchemeId;
2728
use vortex_compressor::stats::ArrayAndStats;
2829
use vortex_error::VortexResult;
2930

@@ -72,11 +73,11 @@ impl Scheme for RunEndScheme {
7273
children: ChildSelection::One(1),
7374
},
7475
DescendantExclusion {
75-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.rle"),
76+
excluded: SchemeId::new("vortex.int.rle"),
7677
children: ChildSelection::One(1),
7778
},
7879
DescendantExclusion {
79-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.sparse"),
80+
excluded: SchemeId::new("vortex.int.sparse"),
8081
children: ChildSelection::One(1),
8182
},
8283
]

‎encodings/sparse/src/schemes/integer.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use vortex_compressor::scheme::DescendantExclusion;
2323
use vortex_compressor::scheme::EstimateVerdict;
2424
use vortex_compressor::scheme::Scheme;
2525
use vortex_compressor::scheme::SchemeExt;
26+
use vortex_compressor::scheme::SchemeId;
2627
use vortex_compressor::stats::ArrayAndStats;
2728
use vortex_compressor::stats::GenerateStatsOptions;
2829
use vortex_error::VortexExpect;
@@ -72,11 +73,11 @@ impl Scheme for SparseScheme {
7273
children: ChildSelection::One(1),
7374
},
7475
DescendantExclusion {
75-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.runend"),
76+
excluded: SchemeId::new("vortex.int.runend"),
7677
children: ChildSelection::One(1),
7778
},
7879
DescendantExclusion {
79-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.rle"),
80+
excluded: SchemeId::new("vortex.int.rle"),
8081
children: ChildSelection::One(1),
8182
},
8283
DescendantExclusion {

‎encodings/zigzag/src/schemes/zigzag.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use vortex_compressor::scheme::DescendantExclusion;
2424
use vortex_compressor::scheme::EstimateVerdict;
2525
use vortex_compressor::scheme::Scheme;
2626
use vortex_compressor::scheme::SchemeExt;
27+
use vortex_compressor::scheme::SchemeId;
2728
use vortex_compressor::stats::ArrayAndStats;
2829
use vortex_error::VortexResult;
2930

@@ -67,11 +68,11 @@ impl Scheme for ZigZagScheme {
6768
children: ChildSelection::All,
6869
},
6970
DescendantExclusion {
70-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.runend"),
71+
excluded: SchemeId::new("vortex.int.runend"),
7172
children: ChildSelection::All,
7273
},
7374
DescendantExclusion {
74-
excluded: vortex_compressor::scheme::SchemeId::new("vortex.int.sparse"),
75+
excluded: SchemeId::new("vortex.int.sparse"),
7576
children: ChildSelection::All,
7677
},
7778
]

‎vortex-bench/src/conversions.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use vortex::array::builders::builder_with_capacity_in;
3838
use vortex::array::stream::ArrayStreamAdapter;
3939
use vortex::array::stream::ArrayStreamExt;
4040
use vortex::compressor::BtrBlocksCompressor;
41+
use vortex::compressor::CompressionSessionExt;
4142
use vortex::dtype::DType;
4243
use vortex::dtype::FieldPath;
4344
use vortex::dtype::StructFields;
@@ -248,8 +249,7 @@ fn write_options_for(
248249
let mut builder = WriteStrategyBuilder::from_session(&SESSION);
249250
if matches!(compaction, CompactionStrategy::Compact) {
250251
builder = builder.with_btrblocks_compressor({
251-
let compression_session =
252-
vortex::compressor::CompressionSessionExt::fork_compression(&*SESSION);
252+
let compression_session = CompressionSessionExt::fork_compression(&*SESSION);
253253
vortex::compressor::initialize_compact(&compression_session);
254254
BtrBlocksCompressor::from_session(&compression_session)
255255
});

‎vortex-bench/src/lib.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use tpch::benchmark::TpcHBenchmark;
2929
pub use utils::file::*;
3030
pub use utils::logging::*;
3131
use vortex::compressor::BtrBlocksCompressor;
32+
use vortex::compressor::CompressionSessionExt;
3233
use vortex::error::VortexExpect;
3334
use vortex::error::vortex_err;
3435
use vortex::file::VortexWriteOptions;
@@ -255,7 +256,7 @@ impl CompactionStrategy {
255256
WriteStrategyBuilder::from_session(&SESSION)
256257
.with_btrblocks_compressor({
257258
let compression_session =
258-
vortex::compressor::CompressionSessionExt::fork_compression(&*SESSION);
259+
CompressionSessionExt::fork_compression(&*SESSION);
259260
vortex::compressor::initialize_compact(&compression_session);
260261
BtrBlocksCompressor::from_session(&compression_session)
261262
})

‎vortex-btrblocks/src/canonical_compressor.rs‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ mod tests {
8686
#[cfg(feature = "zstd")]
8787
use vortex_array::ArrayId;
8888
use vortex_array::IntoArray;
89+
#[cfg(feature = "zstd")]
8990
use vortex_array::VTable;
9091
use vortex_array::VortexSessionExecute;
9192
use vortex_array::arrays::BoolArray;
@@ -94,6 +95,10 @@ mod tests {
9495
use vortex_array::arrays::List;
9596
use vortex_array::arrays::ListView;
9697
use vortex_array::arrays::ListViewArray;
98+
#[cfg(feature = "zstd")]
99+
use vortex_array::arrays::Primitive;
100+
#[cfg(feature = "zstd")]
101+
use vortex_array::arrays::VarBinView;
97102
use vortex_array::arrays::VarBinViewArray;
98103
use vortex_array::assert_arrays_eq;
99104
use vortex_array::dtype::DType;
@@ -103,6 +108,10 @@ mod tests {
103108
use vortex_buffer::buffer;
104109
use vortex_error::VortexResult;
105110
use vortex_session::VortexSession;
111+
#[cfg(feature = "zstd")]
112+
use vortex_zstd::schemes::binary::ZstdScheme;
113+
#[cfg(feature = "zstd")]
114+
use vortex_zstd::schemes::binary_buffers::ZstdBuffersScheme;
106115

107116
use crate::BtrBlocksCompressor;
108117

@@ -315,19 +324,9 @@ mod tests {
315324

316325
let session = vortex_array::array_session();
317326
vortex_zstd::initialize(&session);
318-
crate::CompressionSessionExt::register_scheme(
319-
&session,
320-
&vortex_zstd::schemes::binary::ZstdScheme,
321-
);
322-
crate::CompressionSessionExt::register_scheme(
323-
&session,
324-
&vortex_zstd::schemes::binary_buffers::ZstdBuffersScheme,
325-
);
326-
let permitted = [
327-
allowed,
328-
vortex_array::arrays::VarBinView.id(),
329-
vortex_array::arrays::Primitive.id(),
330-
];
327+
crate::CompressionSessionExt::register_scheme(&session, &ZstdScheme);
328+
crate::CompressionSessionExt::register_scheme(&session, &ZstdBuffersScheme);
329+
let permitted = [allowed, VarBinView.id(), Primitive.id()];
331330
let compressor = BtrBlocksCompressor::from_session_with_encodings(&session, permitted);
332331
let mut ctx = SESSION.create_execution_ctx();
333332
let compressed = compressor.compress(&array.clone().into_array(), &mut ctx)?;
@@ -353,6 +352,7 @@ mod permission_tests {
353352
use vortex_edition::EDITION_DECLARATIONS;
354353
use vortex_edition::EDITION_FAMILIES;
355354
use vortex_edition::EditionSessionExt;
355+
use vortex_edition::declarations::core::CORE_2026_08_3;
356356
use vortex_error::VortexResult;
357357
use vortex_fastlanes::BitPacked;
358358
use vortex_fastlanes::schemes::for_::FoRScheme;
@@ -412,7 +412,7 @@ mod permission_tests {
412412
for edition in EDITION_DECLARATIONS {
413413
session.register_edition(edition)?;
414414
}
415-
session.enable_edition(vortex_edition::declarations::core::CORE_2026_08_3)?;
415+
session.enable_edition(CORE_2026_08_3)?;
416416
let input = buffer![1i32, 2, 3, 4, 5, 6, 7, 8].into_array();
417417
let output = BtrBlocksCompressor::from_session(&session)
418418
.compress(&input, &mut session.create_execution_ctx())?;

‎vortex-btrblocks/tests/golden.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use vortex_array::dtype::Nullability;
4949
use vortex_array::extension::datetime::TimeUnit;
5050
use vortex_array::validity::Validity;
5151
use vortex_btrblocks::BtrBlocksCompressor;
52+
use vortex_btrblocks::schemes::string::OnPairScheme;
5253
use vortex_buffer::Buffer;
5354
use vortex_edition::EDITION_DECLARATIONS;
5455
use vortex_edition::EDITION_FAMILIES;
@@ -58,6 +59,8 @@ use vortex_edition::EditionSessionExt;
5859
use vortex_edition::declarations::core::CORE_2026_08_3;
5960
use vortex_error::VortexResult;
6061
use vortex_session::VortexSession;
62+
#[cfg(all(feature = "zstd", feature = "pco"))]
63+
use vortex_zstd::editions::ZSTD_2026_02;
6164

6265
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
6366
let session = vortex_array::array_session();
@@ -397,9 +400,8 @@ fn list_of_int_runs() -> VortexResult<ArrayRef> {
397400
/// are pinned by [`golden_onpair`].
398401
fn without_onpair(session: &VortexSession) -> VortexSession {
399402
let session = vortex_btrblocks::CompressionSessionExt::fork_compression(session);
400-
vortex_btrblocks::CompressionSessionExt::compression(&session).unregister(
401-
vortex_btrblocks::SchemeExt::id(&vortex_btrblocks::schemes::string::OnPairScheme),
402-
);
403+
vortex_btrblocks::CompressionSessionExt::compression(&session)
404+
.unregister(vortex_btrblocks::SchemeExt::id(&OnPairScheme));
403405
session
404406
}
405407

@@ -442,7 +444,7 @@ fn golden_onpair() -> VortexResult<()> {
442444
fn golden_compact() -> VortexResult<()> {
443445
let session = edition_session(&[CORE_2026_08_3])?;
444446
vortex_zstd::initialize(&session);
445-
session.enable_edition(vortex_zstd::editions::ZSTD_2026_02)?;
447+
session.enable_edition(ZSTD_2026_02)?;
446448
let session = without_onpair(&session);
447449
vortex_btrblocks::initialize_compact(&session);
448450
let compressor = BtrBlocksCompressor::from_session(&session);

‎vortex-btrblocks/tests/varbin_scheme.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ fn varbin_scheme_shrinks_binary() -> VortexResult<()> {
7878
let without = {
7979
let compression_session =
8080
vortex_btrblocks::CompressionSessionExt::fork_compression(&*SESSION);
81-
for id in [VarBinScheme.id()] {
82-
vortex_btrblocks::CompressionSessionExt::compression(&compression_session)
83-
.unregister(id);
84-
}
81+
vortex_btrblocks::CompressionSessionExt::compression(&compression_session)
82+
.unregister(VarBinScheme.id());
8583
BtrBlocksCompressor::for_memory(&compression_session)
8684
};
8785

0 commit comments

Comments
 (0)