Skip to content

Commit 2f25714

Browse files
committed
feat(rust/sedona-raster-gdal): import RS_Clip from apache#704 verbatim
Faithful copy of RS_Clip (src + bench) from the GDAL raster draft PR apache#704, wired into the module list, register, and bench manifest. This commit does NOT compile against current main — it predates several API changes; the reconciliation is isolated into the next commit so the diff there shows exactly what changed from Kristin's original.
1 parent ed5c60d commit 2f25714

5 files changed

Lines changed: 991 additions & 0 deletions

File tree

rust/sedona-raster-gdal/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ sedona-testing = { workspace = true }
5858
tempfile = { workspace = true }
5959
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
6060

61+
[[bench]]
62+
harness = false
63+
name = "rs_clip"
64+
path = "benches/rs_clip.rs"
65+
6166
[[bench]]
6267
harness = false
6368
name = "rs_frompath"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//! Benchmarks for RS_Clip UDF
19+
//!
20+
//! RS_Clip clips rasters to a geometry boundary.
21+
//! Signature: RS_Clip(raster, geometry, [nodata], [crop])
22+
//!
23+
//! NOTE: This benchmark requires geometry creation which needs additional setup.
24+
//! The underlying GDAL segfault issue has been fixed.
25+
//! TODO: Implement full benchmark once geometry utilities are available in bench context.
26+
27+
use criterion::{criterion_group, criterion_main, Criterion};
28+
29+
fn bench_rs_clip_placeholder(c: &mut Criterion) {
30+
let mut group = c.benchmark_group("rs_clip");
31+
32+
// Placeholder benchmark - needs geometry creation utilities
33+
// The underlying GDAL memory dataset issue has been fixed
34+
group.bench_function("placeholder", |b| b.iter(|| std::hint::black_box(42)));
35+
36+
group.finish();
37+
}
38+
39+
criterion_group!(benches, bench_rs_clip_placeholder);
40+
criterion_main!(benches);

rust/sedona-raster-gdal/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ mod gdal_common;
3333
mod gdal_dataset_provider;
3434

3535
mod raster_loader;
36+
mod rs_clip;
3637
mod rs_frompath;
3738
mod rs_metadata;
3839
mod rs_polygonize;

rust/sedona-raster-gdal/src/register.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use sedona_expr::function_set::FunctionSet;
2020
/// Export the set of GDAL-backed functions defined in this crate.
2121
pub fn default_function_set() -> FunctionSet {
2222
let mut function_set = FunctionSet::new();
23+
function_set.insert_scalar_udf(crate::rs_clip::rs_clip_udf());
2324
function_set.insert_scalar_udf(crate::rs_frompath::rs_frompath_udf());
2425
function_set.insert_scalar_udf(crate::rs_metadata::rs_metadata_udf());
2526
function_set.insert_scalar_udf(crate::rs_polygonize::rs_polygonize_udf());

0 commit comments

Comments
 (0)