Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vortex-spatial/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ version.workspace = true

[dependencies]
arrow-array = { workspace = true }
arrow-buffer = { workspace = true }
arrow-schema = { workspace = true }
geo = { workspace = true }
geo-traits = { workspace = true }
Expand All @@ -25,6 +26,7 @@ prost = { workspace = true }
vortex-array = { workspace = true }
vortex-arrow = { workspace = true }
vortex-buffer = { workspace = true }
vortex-dense-union = { workspace = true }
vortex-error = { workspace = true }
vortex-mask = { workspace = true }
vortex-session = { workspace = true }
Expand Down
15 changes: 15 additions & 0 deletions vortex-spatial/src/aggregate_fn/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

//! The 2D axis-aligned bounding-box (AABB) aggregate for native geometry columns.

use geo::BoundingRect;
use geo::Rect as SpatialRect;
use vortex_array::ArrayRef;
use vortex_array::Columnar;
Expand All @@ -23,12 +24,14 @@ use vortex_error::vortex_err;
use vortex_session::VortexSession;
use vortex_session::registry::CachedId;

use crate::extension::Geometry;
use crate::extension::Rect;
use crate::extension::SpatialMetadata;
use crate::extension::box_storage_dtype;
use crate::extension::coordinate::Dimension;
use crate::extension::coordinate::box_corners;
use crate::extension::coordinate::ordinates;
use crate::extension::decode_mixed_geometries;
use crate::extension::flatten_coordinates;
use crate::extension::is_native_geometry;

Expand Down Expand Up @@ -205,6 +208,18 @@ impl AggregateFnVTable for GeometryAabb {
// non-nullable case already costs nothing (the all-true mask makes `filter` a no-op).
let valid = array.validity()?.execute_mask(array.len(), ctx)?;
let array = array.filter(valid)?;
if array
.dtype()
.as_extension_opt()
.is_some_and(|ext| ext.is::<Geometry>())
{
for geometry in decode_mixed_geometries(&array, ctx)? {
if let Some(rect) = geometry.bounding_rect() {
partial.merge(rect);
}
}
return Ok(());
}
// Null rows are gone, so every coordinate below belongs to a present geometry — the
// `unmasked_field_by_name` reads are therefore safe. Min/max the raw x/y buffers directly:
// cheap, and avoids `to_geometry`'s panic on empty points (which decoding would hit).
Expand Down
Loading
Loading