feat(raster-gdal): add parse_outdb_source helper for the GDAL format driver#812
Merged
Merged
Conversation
6 tasks
dd61091 to
bf5ba23
Compare
4 tasks
paleolimbot
approved these changes
May 5, 2026
Member
paleolimbot
left a comment
There was a problem hiding this comment.
A few optional suggestions...thank you!
bf5ba23 to
9b5c8dc
Compare
paleolimbot
approved these changes
May 5, 2026
Member
paleolimbot
left a comment
There was a problem hiding this comment.
Optional nit (feel free to merge whenever after an approve when you're happy with it 🙂 )
Add a crate-private parse_outdb_source helper that splits a SedonaDB
outdb URI into the underlying URI plus a 1-based source band index.
Two URI shapes are accepted, both private to the GDAL format driver:
- '<uri>#band=N' — SedonaDB convention for selecting band N.
- GDAL native subdataset URI ('HDF5:"x.h5":/var', 'GTIFF_DIR:N:foo.tif',
...) — passed through verbatim, defaulting to band 1.
Plain URIs default to band 1. Malformed '#band=' fragments (non-numeric,
zero, negative, > u32::MAX) return a clear Execution error.
Format-agnostic surfaces (incl. RS_BandPath) treat outdb_uri as opaque;
the parser is dispatched only when outdb_format routes to the GDAL
driver.
9b5c8dc to
8e8a6cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
parse_outdb_source(uri) -> (Cow<str>, u32)inrust/sedona-raster-gdal/src/source_uri.rs. It is a GDAL-format-driver-internal helper: when an outdb band'soutdb_formatdispatches to GDAL, the loader calls this to pick the source band out ofoutdb_uri. Two recognised forms:<uri>#band=N→(uri without fragment, N).rsplit_once('#')is used so a trailing#band=Nwins over an earlier#anchorin the URI.HDF5:\"x.h5\":/var,NETCDF:\"file.nc\":var,GTIFF_DIR:N:foo.tif, … →(uri verbatim, 1). We don't try to interpret the GDAL grammar; we just pass it through.band=fragment →(uri, 1).#band=fragment (non-numeric, zero, negative, >u32::MAX) — returns anExecutionerror. The user explicitly asked for a band; we refuse to silently fall back to band 1.Returns
Cow::Borrowedfor both common cases (no allocation when the input has no fragment, and only the trimmed prefix is borrowed when a#band=Nis present).Scope
This is not a SedonaDB-wide URI convention. The schema treats
outdb_urias opaque, andRS_BandPathand other format-agnostic surfaces continue to do so. The#band=Nshape only has meaning inside the GDAL format driver — other format drivers (Zarr, MDArray, …) handle their own URIs however they want, and unrelated callers likeRS_BandPathare untouched.Why encode the source band index inside
outdb_uri(for GDAL)?#787 introduced an
outdb_band_id: u32column alongsideoutdb_url. The follow-up work on N-D rasters needs the GDAL driver to also support GDAL native subdataset URIs (HDF5 groups, multi-page GeoTIFFs, NetCDF variables). Those URIs already carry the source-selector inline, so a typed sibling column would be redundant and couldn't represent them. Inside the GDAL driver, folding both forms (#band=Nfor plain rasters, native subdataset syntax for everything else) into one parser keeps the driver's URI handling in one place.Purely additive
No existing call sites are rewired. The first caller will appear in a follow-up PR that ports the GDAL loader to read the source band selector from
outdb_uriinstead of a separateoutdb_band_idcolumn.Test plan
cargo test -p sedona-raster-gdal— 43 unit tests + 1 doctest passcargo build -p sedona-schema -p sedona-raster -p sedona-raster-gdal -p sedona-raster-functions -p sedona-testingcargo test -p sedona-schema -p sedona-raster -p sedona-raster-gdal -p sedona-raster-functions -p sedona-testing— 315 unit tests + 4 doctests, 0 failurescargo clippy -p sedona-schema -p sedona-raster -p sedona-raster-gdal -p sedona-raster-functions -p sedona-testing --all-targets -- -D warnings— cleancargo fmt --all --check— cleanpre-commit run --files rust/sedona-raster-gdal/src/source_uri.rs rust/sedona-raster-gdal/src/lib.rs— cleanThe unit tests in
source_uri::testscover: default band 1; explicitband=N; malformed#band=(zero, negative, overflow, non-numeric) returning a clear Execution error; URL query strings preserved before fragment; local paths; HDF5/NETCDF/GTIFF_DIR subdataset passthrough; trailing#band=Nwinning over earlier#anchor; empty URI;Cow::Borrowedinvariants.