66use vortex_utils:: aliases:: hash_set:: HashSet ;
77
88use crate :: BtrBlocksCompressor ;
9+ use crate :: CascadingCompressor ;
910use crate :: Scheme ;
11+ use crate :: SchemeExt ;
1012use 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
103105impl 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