Skip to content

Commit d789886

Browse files
fix: make GeometryBounds serializable for zone-map persistence
The zoned writer serializes each zone stat descriptor to persist it, but GeometryBounds used the default (non-serializable), so writing a geometry column zone map failed at write time. Add serialize/deserialize (no options) plus a regression test. Signed-off-by: Nemo Yu <zyu379@wisc.edu>
1 parent 0af473a commit d789886

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

vortex-geo/src/aggregate_fn/bounds.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use vortex_array::dtype::StructFields;
2323
use vortex_array::scalar::Scalar;
2424
use vortex_error::VortexResult;
2525
use vortex_error::vortex_err;
26+
use vortex_session::VortexSession;
2627

2728
use crate::extension::coordinates;
2829
use crate::extension::is_native_geometry;
@@ -112,6 +113,15 @@ impl AggregateFnVTable for GeometryBounds {
112113
AggregateFnId::new("vortex.geo.bounds")
113114
}
114115

116+
// Serializable so the zoned writer can persist this as a per-chunk stat. No options to encode.
117+
fn serialize(&self, _options: &Self::Options) -> VortexResult<Option<Vec<u8>>> {
118+
Ok(Some(vec![]))
119+
}
120+
121+
fn deserialize(&self, _metadata: &[u8], _session: &VortexSession) -> VortexResult<Self::Options> {
122+
Ok(EmptyOptions)
123+
}
124+
115125
fn return_dtype(&self, _options: &Self::Options, input_dtype: &DType) -> Option<DType> {
116126
is_native_geometry(input_dtype).then(bounds_dtype)
117127
}
@@ -217,6 +227,7 @@ impl AggregateFnVTable for GeometryBounds {
217227
mod tests {
218228
use vortex_array::VortexSessionExecute;
219229
use vortex_array::aggregate_fn::Accumulator;
230+
use vortex_array::aggregate_fn::AggregateFnVTable;
220231
use vortex_array::aggregate_fn::DynAccumulator;
221232
use vortex_array::aggregate_fn::EmptyOptions;
222233
use vortex_array::scalar::Scalar;
@@ -227,6 +238,17 @@ mod tests {
227238
use crate::test_harness::point_column;
228239
use crate::test_harness::polygon_column;
229240

241+
/// The aggregate must be serializable so the zoned writer can persist its zone-stat descriptor.
242+
#[test]
243+
fn serializes_for_zone_storage() -> VortexResult<()> {
244+
let session = vortex_array::array_session();
245+
let metadata = GeometryBounds
246+
.serialize(&EmptyOptions)?
247+
.expect("GeometryBounds must be serializable to be stored as a zone statistic");
248+
GeometryBounds.deserialize(&metadata, &session)?;
249+
Ok(())
250+
}
251+
230252
/// The MBR result's corners as `(xmin, ymin, xmax, ymax)`.
231253
fn mbr(result: &Scalar) -> VortexResult<(f64, f64, f64, f64)> {
232254
let fields = result.as_struct();

0 commit comments

Comments
 (0)