Skip to content

Commit dc02c7d

Browse files
committed
Revert on-disk change
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 50d393a commit dc02c7d

5 files changed

Lines changed: 10 additions & 27 deletions

File tree

vortex-array/src/stats/flatbuffers.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl WriteFlatBuffer for StatsSet {
4747
fba::Precision::Inexact,
4848
Some(fbb.create_vector(&ScalarValue::to_proto_bytes::<Vec<u8>>(Some(&min)))),
4949
),
50-
Precision::Absent => (fba::Precision::Absent, None),
50+
Precision::Absent => (fba::Precision::Inexact, None),
5151
};
5252

5353
let (max_precision, max) = match self.get(Stat::Max) {
@@ -59,7 +59,7 @@ impl WriteFlatBuffer for StatsSet {
5959
fba::Precision::Inexact,
6060
Some(fbb.create_vector(&ScalarValue::to_proto_bytes::<Vec<u8>>(Some(&max)))),
6161
),
62-
Precision::Absent => (fba::Precision::Absent, None),
62+
Precision::Absent => (fba::Precision::Inexact, None),
6363
};
6464

6565
let sum = self
@@ -132,11 +132,6 @@ impl StatsSet {
132132
if let Some(max) = fb.max()
133133
&& let Some(stat_dtype) = stat_dtype
134134
{
135-
let max_precision = fb.max_precision();
136-
if max_precision == fba::Precision::Absent {
137-
vortex_bail!("Corrupted max stat: value present with absent precision");
138-
}
139-
140135
let value =
141136
ScalarValue::from_proto_bytes(max.bytes(), &stat_dtype, session)?;
142137
let Some(value) = value else {
@@ -145,7 +140,7 @@ impl StatsSet {
145140

146141
stats_set.set(
147142
Stat::Max,
148-
match max_precision {
143+
match fb.max_precision() {
149144
fba::Precision::Exact => Precision::Exact(value),
150145
fba::Precision::Inexact => Precision::Inexact(value),
151146
other => vortex_bail!("Corrupted max_precision field: {other:?}"),
@@ -157,11 +152,6 @@ impl StatsSet {
157152
if let Some(min) = fb.min()
158153
&& let Some(stat_dtype) = stat_dtype
159154
{
160-
let min_precision = fb.min_precision();
161-
if min_precision == fba::Precision::Absent {
162-
vortex_bail!("Corrupted min stat: value present with absent precision");
163-
}
164-
165155
let value =
166156
ScalarValue::from_proto_bytes(min.bytes(), &stat_dtype, session)?;
167157
let Some(value) = value else {
@@ -170,7 +160,7 @@ impl StatsSet {
170160

171161
stats_set.set(
172162
Stat::Min,
173-
match min_precision {
163+
match fb.min_precision() {
174164
fba::Precision::Exact => Precision::Exact(value),
175165
fba::Precision::Inexact => Precision::Inexact(value),
176166
other => vortex_bail!("Corrupted min_precision field: {other:?}"),

vortex-flatbuffers/flatbuffers/vortex-array/array.fbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ table ArrayNode {
4040
enum Precision: uint8 {
4141
Inexact = 0,
4242
Exact = 1,
43-
Absent = 2,
4443
}
4544

4645
table ArrayStats {

vortex-flatbuffers/public-api.lock

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,6 @@ pub fn vortex_flatbuffers::array::Compression::run_verifier(&mut flatbuffers::ve
450450

451451
impl vortex_flatbuffers::array::Precision
452452

453-
pub const vortex_flatbuffers::array::Precision::Absent: Self
454-
455453
pub const vortex_flatbuffers::array::Precision::ENUM_MAX: u8
456454

457455
pub const vortex_flatbuffers::array::Precision::ENUM_MIN: u8
@@ -534,7 +532,7 @@ pub const vortex_flatbuffers::array::ENUM_MIN_PRECISION: u8
534532

535533
pub const vortex_flatbuffers::array::ENUM_VALUES_COMPRESSION: [vortex_flatbuffers::array::Compression; 2]
536534

537-
pub const vortex_flatbuffers::array::ENUM_VALUES_PRECISION: [vortex_flatbuffers::array::Precision; 3]
535+
pub const vortex_flatbuffers::array::ENUM_VALUES_PRECISION: [vortex_flatbuffers::array::Precision; 2]
538536

539537
pub fn vortex_flatbuffers::array::finish_array_buffer<'a, 'b, A: flatbuffers::builder::Allocator + 'a>(&'b mut flatbuffers::builder::FlatBufferBuilder<'a, A>, flatbuffers::primitives::WIPOffset<vortex_flatbuffers::array::Array<'a>>)
540538

vortex-flatbuffers/src/generated/array.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ impl ::flatbuffers::SimpleToVerifyInSlice for Compression {}
9191
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
9292
pub const ENUM_MIN_PRECISION: u8 = 0;
9393
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
94-
pub const ENUM_MAX_PRECISION: u8 = 2;
94+
pub const ENUM_MAX_PRECISION: u8 = 1;
9595
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
9696
#[allow(non_camel_case_types)]
97-
pub const ENUM_VALUES_PRECISION: [Precision; 3] = [
97+
pub const ENUM_VALUES_PRECISION: [Precision; 2] = [
9898
Precision::Inexact,
9999
Precision::Exact,
100-
Precision::Absent,
101100
];
102101

103102
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@@ -107,21 +106,18 @@ pub struct Precision(pub u8);
107106
impl Precision {
108107
pub const Inexact: Self = Self(0);
109108
pub const Exact: Self = Self(1);
110-
pub const Absent: Self = Self(2);
111109

112110
pub const ENUM_MIN: u8 = 0;
113-
pub const ENUM_MAX: u8 = 2;
111+
pub const ENUM_MAX: u8 = 1;
114112
pub const ENUM_VALUES: &'static [Self] = &[
115113
Self::Inexact,
116114
Self::Exact,
117-
Self::Absent,
118115
];
119116
/// Returns the variant's name or "" if unknown.
120117
pub fn variant_name(self) -> Option<&'static str> {
121118
match self {
122119
Self::Inexact => Some("Inexact"),
123120
Self::Exact => Some("Exact"),
124-
Self::Absent => Some("Absent"),
125121
_ => None,
126122
}
127123
}

vortex-layout/src/display.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ mod tests {
334334
let expected = "\
335335
vortex.struct, dtype: {numbers=i64?, strings=utf8}, children: 2, rows: 5
336336
├── numbers: vortex.chunked, dtype: i64?, children: 1, rows: 5
337-
│ └── [0]: vortex.flat, dtype: i64?, metadata: 187 bytes, rows: 5, segment 0, buffers=[40B, 1B], total=41B
338-
└── strings: vortex.flat, dtype: utf8, metadata: 122 bytes, rows: 5, segment 1, buffers=[43B, 80B], total=123B
337+
│ └── [0]: vortex.flat, dtype: i64?, metadata: 171 bytes, rows: 5, segment 0, buffers=[40B, 1B], total=41B
338+
└── strings: vortex.flat, dtype: utf8, metadata: 110 bytes, rows: 5, segment 1, buffers=[43B, 80B], total=123B
339339
";
340340
assert_eq!(output, expected);
341341
})

0 commit comments

Comments
 (0)