Skip to content

Commit ba8c05d

Browse files
committed
fixup
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 8def112 commit ba8c05d

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

vortex-btrblocks/src/schemes/float.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ use vortex_alp::alp_encode;
1313
use vortex_array::ArrayRef;
1414
use vortex_array::Canonical;
1515
use vortex_array::IntoArray;
16+
use vortex_array::LEGACY_SESSION;
1617
use vortex_array::ToCanonical;
18+
use vortex_array::VortexSessionExecute;
19+
use vortex_array::arrays::Patched;
1720
use vortex_array::arrays::primitive::PrimitiveArrayExt;
1821
use vortex_array::dtype::PType;
1922
use vortex_compressor::estimate::CompressionEstimate;
2023
use vortex_compressor::scheme::ChildSelection;
2124
use vortex_compressor::scheme::DescendantExclusion;
2225
use vortex_error::VortexResult;
2326
use vortex_error::vortex_panic;
27+
use vortex_fastlanes::USE_EXPERIMENTAL_PATCHES;
2428
use vortex_sparse::Sparse;
2529

2630
use super::integer::SparseScheme as IntSparseScheme;
@@ -107,11 +111,30 @@ impl Scheme for ALPScheme {
107111
let compressed_alp_ints =
108112
compressor.compress_child(alp_encoded.encoded(), &ctx, self.id(), 0)?;
109113

110-
// Patches are not compressed. They should be infrequent, and if they are not then we want
111-
// to keep them linear for easy indexing.
112-
let patches = alp_encoded.patches().map(compress_patches).transpose()?;
114+
let alp_stats = alp_encoded.as_array().statistics().to_owned();
115+
let exponents = alp_encoded.exponents();
116+
117+
if *USE_EXPERIMENTAL_PATCHES {
118+
let patches = alp_encoded.patches();
119+
120+
// Create ALP array without interior patches.
121+
let alp_array = ALP::new(compressed_alp_ints, exponents, None).into_array();
122+
123+
match patches {
124+
None => Ok(alp_array),
125+
Some(p) => Ok(Patched::from_array_and_patches(
126+
alp_array,
127+
&p,
128+
&mut LEGACY_SESSION.create_execution_ctx(),
129+
)?
130+
.with_stats_set(alp_stats)
131+
.into_array()),
132+
}
133+
} else {
134+
let patches = alp_encoded.patches().map(compress_patches).transpose()?;
113135

114-
Ok(ALP::new(compressed_alp_ints, alp_encoded.exponents(), patches).into_array())
136+
Ok(ALP::new(compressed_alp_ints, exponents, patches).into_array())
137+
}
115138
}
116139
}
117140

0 commit comments

Comments
 (0)