Skip to content

Commit a3c3589

Browse files
committed
new produced_encodings
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 4f46db3 commit a3c3589

33 files changed

Lines changed: 197 additions & 12 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/specs/editions.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Every file you write carries the read-forever guarantee. If a file would contain
3737
outside the targeted edition, the write fails immediately; edition violations never surface as
3838
someone else's read error later.
3939

40+
The enabled editions are stored on the writer's Vortex session. Registering an edition makes
41+
its declaration available to the session; enabling it separately allows the writer to emit its
42+
encodings. Enabling another edition from the same family replaces the earlier selection.
43+
4044
Two knobs exist when the default is not what you want:
4145

4246
- **Pin an older edition** when files must stay readable by deployments running older Vortex.
@@ -45,9 +49,10 @@ Two knobs exist when the default is not what you want:
4549
example spatial encodings) possible later. A writer targets at most one edition per family
4650
and may emit any encoding in their union; each encoding belongs to exactly one family.
4751

48-
You can also opt out of editions entirely to write custom or experimental encodings. Doing so
49-
is an explicit choice that gives up the standardization guarantee — only readers that know your
50-
encodings can read those files.
52+
Lower-level sessions without an enabled-editions store opt out of editions entirely and can write
53+
custom or experimental encodings. A raw `with_allow_encodings` writer policy is another explicit
54+
opt-out. Either choice gives up the standardization guarantee — only readers that know those
55+
encodings can read the files.
5156

5257
## How editions change
5358

vortex-btrblocks/src/schemes/binary/zstd.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
//! Zstd compression for binary arrays.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
910
use vortex_array::IntoArray;
11+
use vortex_array::VTable;
1012
use vortex_compressor::scheme::CompressionEstimate;
1113
use vortex_compressor::scheme::DeferredEstimate;
1214
use vortex_error::VortexResult;
@@ -29,6 +31,10 @@ impl Scheme for ZstdScheme {
2931
canonical.dtype().is_binary()
3032
}
3133

34+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
35+
Some(vec![vortex_zstd::Zstd.id()])
36+
}
37+
3238
fn expected_compression_ratio(
3339
&self,
3440
_data: &ArrayAndStats,

vortex-btrblocks/src/schemes/binary/zstd_buffers.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
//! Zstd buffer-level binary compression preserving array layout for GPU decompression.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
910
use vortex_array::IntoArray;
11+
use vortex_array::VTable;
1012
use vortex_compressor::scheme::CompressionEstimate;
1113
use vortex_compressor::scheme::DeferredEstimate;
1214
use vortex_error::VortexResult;
@@ -29,6 +31,10 @@ impl Scheme for ZstdBuffersScheme {
2931
canonical.dtype().is_binary()
3032
}
3133

34+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
35+
Some(vec![vortex_zstd::ZstdBuffers.id()])
36+
}
37+
3238
fn expected_compression_ratio(
3339
&self,
3440
_data: &ArrayAndStats,

vortex-btrblocks/src/schemes/decimal.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
//! Decimal compression scheme using byte-part decomposition.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
910
use vortex_array::IntoArray;
11+
use vortex_array::VTable;
1012
use vortex_array::arrays::DecimalArray;
1113
use vortex_array::arrays::PrimitiveArray;
1214
use vortex_array::arrays::decimal::narrowed_decimal;
@@ -38,6 +40,10 @@ impl Scheme for DecimalScheme {
3840
matches!(canonical, Canonical::Decimal(_))
3941
}
4042

43+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
44+
Some(vec![DecimalByteParts.id()])
45+
}
46+
4147
/// Children: primitive=0.
4248
fn num_children(&self) -> usize {
4349
1

vortex-btrblocks/src/schemes/float/alp.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use vortex_alp::ALP;
77
use vortex_alp::ALPArrayExt;
88
use vortex_alp::ALPArraySlotsExt;
99
use vortex_alp::alp_encode;
10+
use vortex_array::ArrayId;
1011
use vortex_array::ArrayRef;
1112
use vortex_array::Canonical;
1213
use vortex_array::ExecutionCtx;
1314
use vortex_array::IntoArray;
15+
use vortex_array::VTable;
1416
use vortex_array::arrays::Patched;
1517
use vortex_array::arrays::patched::use_experimental_patches;
1618
use vortex_array::arrays::primitive::PrimitiveArrayExt;
@@ -40,6 +42,14 @@ impl Scheme for ALPScheme {
4042
canonical.dtype().is_float()
4143
}
4244

45+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
46+
let mut encodings = vec![ALP.id()];
47+
if use_experimental_patches() {
48+
encodings.push(Patched.id());
49+
}
50+
Some(encodings)
51+
}
52+
4353
/// Children: encoded_ints=0.
4454
fn num_children(&self) -> usize {
4555
1

vortex-btrblocks/src/schemes/float/alprd.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
use vortex_alp::ALPRDArrayExt;
77
use vortex_alp::ALPRDArrayOwnedExt;
88
use vortex_alp::RDEncoder;
9+
use vortex_array::ArrayId;
910
use vortex_array::ArrayRef;
1011
use vortex_array::Canonical;
1112
use vortex_array::ExecutionCtx;
1213
use vortex_array::IntoArray;
14+
use vortex_array::VTable;
1315
use vortex_array::arrays::primitive::PrimitiveArrayExt;
1416
use vortex_array::dtype::PType;
1517
use vortex_compressor::scheme::CompressionEstimate;
@@ -37,6 +39,10 @@ impl Scheme for ALPRDScheme {
3739
canonical.dtype().is_float()
3840
}
3941

42+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
43+
Some(vec![vortex_alp::ALPRD.id()])
44+
}
45+
4046
fn expected_compression_ratio(
4147
&self,
4248
data: &ArrayAndStats,

vortex-btrblocks/src/schemes/float/pco.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
//! Pco (pcodec) float compression.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
910
use vortex_array::IntoArray;
11+
use vortex_array::VTable;
1012
use vortex_compressor::scheme::CompressionEstimate;
1113
use vortex_compressor::scheme::DeferredEstimate;
1214
use vortex_error::VortexResult;
@@ -29,6 +31,10 @@ impl Scheme for PcoScheme {
2931
canonical.dtype().is_float()
3032
}
3133

34+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
35+
Some(vec![vortex_pco::Pco.id()])
36+
}
37+
3238
fn expected_compression_ratio(
3339
&self,
3440
_data: &ArrayAndStats,

vortex-btrblocks/src/schemes/float/rle.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33

44
//! Run-length float encoding.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
10+
use vortex_array::VTable;
911
use vortex_compressor::scheme::AncestorExclusion;
1012
use vortex_compressor::scheme::CompressionEstimate;
1113
use vortex_compressor::scheme::DeferredEstimate;
1214
use vortex_compressor::scheme::DescendantExclusion;
1315
use vortex_compressor::scheme::EstimateVerdict;
1416
use vortex_error::VortexResult;
17+
use vortex_fastlanes::RLE;
1518

1619
use crate::ArrayAndStats;
1720
use crate::CascadingCompressor;
@@ -35,6 +38,10 @@ impl Scheme for FloatRLEScheme {
3538
canonical.dtype().is_float()
3639
}
3740

41+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
42+
Some(vec![RLE.id()])
43+
}
44+
3845
/// Children: values=0, indices=1, offsets=2.
3946
fn num_children(&self) -> usize {
4047
3

vortex-btrblocks/src/schemes/float/sparse.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
//! Sparse encoding for null-dominated float arrays.
55
6+
use vortex_array::ArrayId;
67
use vortex_array::ArrayRef;
78
use vortex_array::Canonical;
89
use vortex_array::ExecutionCtx;
910
use vortex_array::IntoArray;
11+
use vortex_array::VTable;
1012
use vortex_array::arrays::PrimitiveArray;
1113
use vortex_array::arrays::primitive::PrimitiveArrayExt;
1214
use vortex_compressor::scheme::ChildSelection;
@@ -39,6 +41,10 @@ impl Scheme for NullDominatedSparseScheme {
3941
canonical.dtype().is_float()
4042
}
4143

44+
fn produced_encodings(&self) -> Option<Vec<ArrayId>> {
45+
Some(vec![Sparse.id()])
46+
}
47+
4248
/// Children: indices=0.
4349
fn num_children(&self) -> usize {
4450
1

0 commit comments

Comments
 (0)