Skip to content

Commit

Permalink
for compress the offsets before delta
Browse files Browse the repository at this point in the history
  • Loading branch information
danking committed Sep 30, 2024
1 parent f7636d9 commit b50d382
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions vortex-sampling-compressor/src/compressors/fsst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use vortex_error::{vortex_bail, VortexResult};
use vortex_fsst::{fsst_compress, fsst_train_compressor, FSSTArray, FSSTEncoding, FSST};

use super::delta::DeltaCompressor;
use super::r#for::FoRCompressor;
use super::{CompressedArray, CompressionTree, EncoderMetadata, EncodingCompressor};
use crate::SamplingCompressor;

Expand Down Expand Up @@ -96,15 +97,21 @@ impl EncodingCompressor for FSSTCompressor {
let codes_varbin = VarBinArray::try_from(fsst_array.codes())?;
let codes_varbin_dtype = codes_varbin.dtype().clone();

let codes_offsets_delta = DeltaCompressor.compress(
let codes_offsets_for = FoRCompressor.compress(
&codes_varbin.offsets(),
like.as_ref().and_then(|l| l.child(1).cloned()),
ctx.auxiliary("offsets"),
ctx.auxiliary("offsets_for"),
)?;

let codes_offsets_delta = DeltaCompressor.compress(
&codes_offsets_for.array,
like.as_ref().and_then(|l| l.child(2).cloned()),
ctx.auxiliary("offsets_for_delta"),
)?;

let codes_offsets_compressed = codes_compressor.auxiliary("delta_offsets").compress(
&codes_offsets_delta.array,
like.as_ref().and_then(|l| l.child(2)),
like.as_ref().and_then(|l| l.child(3)),
)?;

let codes = VarBinArray::try_new(
Expand All @@ -128,6 +135,7 @@ impl EncodingCompressor for FSSTCompressor {
self,
vec![
uncompressed_lengths.path,
codes_offsets_for.path,
codes_offsets_delta.path,
codes_offsets_compressed.path,
],
Expand Down

0 comments on commit b50d382

Please sign in to comment.