Skip to content

Commit 355df2d

Browse files
committed
compress dict array values
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 8efe1dc commit 355df2d

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

vortex-btrblocks/src/compressor/float/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,14 @@ impl Scheme for DictScheme {
433433
let has_all_values_referenced = dict.has_all_values_referenced();
434434
let DictArrayParts { codes, values, .. } = dict.into_parts();
435435

436+
// TODO(connor): This should probably be extending the `excludes` list.
436437
let compressed_codes = compressor.compress_canonical(
437438
Canonical::Primitive(codes.to_primitive()),
438439
ctx.descend(),
439440
Excludes::int_only(&[IntCode::Dict, IntCode::Sequence]),
440441
)?;
441442

442-
assert!(values.is_canonical());
443+
// TODO(connor): This should probably be extending the `excludes` list.
443444
let compressed_values = compressor.compress_canonical(
444445
Canonical::Primitive(values.to_primitive()),
445446
ctx.descend(),

vortex-btrblocks/src/compressor/integer/mod.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,21 +703,32 @@ impl Scheme for DictScheme {
703703

704704
let dict = dictionary_encode(stats);
705705

706-
// Cascade the codes child
707-
// Don't allow SequenceArray as the codes child as it merely adds extra indirection without actually compressing data.
708-
let mut new_excludes = vec![IntCode::Dict, IntCode::Sequence];
709-
new_excludes.extend_from_slice(excludes);
706+
// Cascade the codes child.
707+
// Don't allow SequenceArray as the codes child as it merely adds extra indirection without
708+
// actually compressing data.
709+
let mut codes_excludes = vec![IntCode::Dict, IntCode::Sequence];
710+
codes_excludes.extend_from_slice(excludes);
710711

711712
let compressed_codes = compressor.compress_canonical(
712713
Canonical::Primitive(dict.codes().to_primitive().narrow()?),
713714
ctx.descend(),
714-
Excludes::int_only(&new_excludes),
715+
Excludes::int_only(&codes_excludes),
716+
)?;
717+
718+
// Cascade the values child.
719+
let mut values_excludes = vec![IntCode::Dict];
720+
values_excludes.extend_from_slice(excludes);
721+
722+
let compressed_values = compressor.compress_canonical(
723+
Canonical::Primitive(dict.values().to_primitive()),
724+
ctx.descend(),
725+
Excludes::int_only(&values_excludes),
715726
)?;
716727

717-
// SAFETY: compressing codes does not change their values
728+
// SAFETY: Compressing the arrays does not change their logical values.
718729
unsafe {
719730
Ok(
720-
DictArray::new_unchecked(compressed_codes, dict.values().clone())
731+
DictArray::new_unchecked(compressed_codes, compressed_values)
721732
.set_all_values_referenced(dict.has_all_values_referenced())
722733
.into_array(),
723734
)

0 commit comments

Comments
 (0)