Skip to content

Commit 69998e9

Browse files
chore(rust): Remove documentation field from SedonaScalarUDF and SedonaAggregateUDF (#633)
1 parent fb37310 commit 69998e9

78 files changed

Lines changed: 91 additions & 210 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

c/sedona-extension/src/scalar_kernel.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,8 @@ mod test {
695695

696696
let array_value = create_array(&[Some("POINT (0 1)"), None], &WKB_GEOMETRY);
697697

698-
let udf_native = SedonaScalarUDF::new(
699-
"simple_udf",
700-
vec![kernel.clone()],
701-
Volatility::Immutable,
702-
None,
703-
);
698+
let udf_native =
699+
SedonaScalarUDF::new("simple_udf", vec![kernel.clone()], Volatility::Immutable);
704700

705701
let tester = ScalarUdfTester::new(udf_native.into(), vec![WKB_GEOMETRY]);
706702
tester.assert_return_type(WKB_GEOMETRY);
@@ -721,7 +717,6 @@ mod test {
721717
"simple_udf_from_ffi",
722718
vec![Arc::new(imported_kernel)],
723719
Volatility::Immutable,
724-
None,
725720
);
726721

727722
let ffi_tester = ScalarUdfTester::new(udf_from_ffi.clone().into(), vec![WKB_GEOMETRY]);
@@ -776,7 +771,6 @@ mod test {
776771
"simple_udf_from_ffi",
777772
vec![Arc::new(imported_kernel)],
778773
Volatility::Immutable,
779-
None,
780774
);
781775

782776
let ffi_tester = ScalarUdfTester::new(
@@ -831,7 +825,6 @@ mod test {
831825
"simple_udf_from_ffi",
832826
vec![Arc::new(imported_kernel)],
833827
Volatility::Immutable,
834-
None,
835828
);
836829

837830
let ffi_tester = ScalarUdfTester::new(udf_from_ffi.clone().into(), vec![WKB_GEOMETRY]);
@@ -855,7 +848,6 @@ mod test {
855848
"simple_udf_from_ffi",
856849
vec![Arc::new(imported_kernel)],
857850
Volatility::Immutable,
858-
None,
859851
);
860852

861853
let ffi_tester = ScalarUdfTester::new(udf_from_ffi.clone().into(), vec![WKB_GEOMETRY]);

c/sedona-geos/src/st_polygonize_agg.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ mod tests {
227227
"st_polygonize_agg",
228228
st_polygonize_agg_impl(),
229229
datafusion_expr::Volatility::Immutable,
230-
None,
231230
)
232231
}
233232

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
title: RS_GeoReference
20+
description: >
21+
Returns the georeference metadata of raster as a string in GDAL or ESRI format
22+
as commonly seen in a world file. Default is GDAL if not specified. Both formats
23+
output six lines: scalex, skewy, skewx, scaley, upperleftx, upperlefty. In GDAL
24+
format the upper-left coordinates refer to the corner of the upper-left pixel,
25+
while in ESRI format they are shifted to the center of the upper-left pixel.
26+
kernels:
27+
- returns: utf8
28+
args: [raster]
29+
- returns: utf8
30+
args:
31+
- raster
32+
- name: format
33+
type: utf8
34+
description: >
35+
Output format, either 'GDAL' (default) or 'ESRI'. GDAL reports the
36+
upper-left corner of the upper-left pixel; ESRI shifts the coordinates
37+
to the center of the upper-left pixel.
38+
---
39+
40+
## Examples
41+
42+
```sql
43+
SELECT RS_GeoReference(RS_Example());
44+
```

docs/reference/sql/rs_numbands.qmd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
title: RS_NumBands
20+
description: Returns the number of bands in the raster.
21+
kernels:
22+
- returns: uint32
23+
args: [raster]
24+
---
25+
26+
## Examples
27+
28+
```sql
29+
SELECT RS_NumBands(RS_Example());
30+
```

python/sedonadb/src/udf.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ pub fn sedona_scalar_udf<'py>(
6161
};
6262

6363
let scalar_kernel = sedona_scalar_kernel(py, py_input_types, py_return_type, py_invoke_batch)?;
64-
let sedona_scalar_udf =
65-
SedonaScalarUDF::new(name, vec![Arc::new(scalar_kernel)], volatility, None);
64+
let sedona_scalar_udf = SedonaScalarUDF::new(name, vec![Arc::new(scalar_kernel)], volatility);
6665

6766
Ok(PySedonaScalarUdf {
6867
inner: sedona_scalar_udf,

rust/sedona-expr/src/aggregate_udf.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub struct SedonaAggregateUDF {
7070
name: String,
7171
signature: Signature,
7272
kernels: Vec<SedonaAccumulatorRef>,
73-
documentation: Option<Documentation>,
7473
}
7574

7675
impl PartialEq for SedonaAggregateUDF {
@@ -93,14 +92,12 @@ impl SedonaAggregateUDF {
9392
name: &str,
9493
kernels: impl IntoSedonaAccumulatorRefs,
9594
volatility: Volatility,
96-
documentation: Option<Documentation>,
9795
) -> Self {
9896
let signature = Signature::user_defined(volatility);
9997
Self {
10098
name: name.to_string(),
10199
signature,
102100
kernels: kernels.into_sedona_accumulator_refs(),
103-
documentation,
104101
}
105102
}
106103

@@ -111,14 +108,9 @@ impl SedonaAggregateUDF {
111108
/// expected that the actual functionality will be registered from one or more
112109
/// independent crates (e.g., ST_Union_Agg(), which may be implemented in
113110
/// sedona-geo or sedona-geography).
114-
pub fn new_stub(
115-
name: &str,
116-
arg_matcher: ArgMatcher,
117-
volatility: Volatility,
118-
documentation: Option<Documentation>,
119-
) -> Self {
111+
pub fn new_stub(name: &str, arg_matcher: ArgMatcher, volatility: Volatility) -> Self {
120112
let stub_kernel = StubAccumulator::new(name.to_string(), arg_matcher);
121-
Self::new(name, stub_kernel, volatility, documentation)
113+
Self::new(name, stub_kernel, volatility)
122114
}
123115

124116
/// Add a new kernel to an Aggregate UDF
@@ -226,7 +218,7 @@ impl AggregateUDFImpl for SedonaAggregateUDF {
226218
}
227219

228220
fn documentation(&self) -> Option<&Documentation> {
229-
self.documentation.as_ref()
221+
None
230222
}
231223
}
232224

@@ -317,7 +309,6 @@ mod test {
317309
"empty",
318310
Vec::<SedonaAccumulatorRef>::new(),
319311
Volatility::Immutable,
320-
None,
321312
);
322313
assert_eq!(udf.name(), "empty");
323314
let err = udf.return_field(&[]).unwrap_err();
@@ -340,7 +331,6 @@ mod test {
340331
"stubby",
341332
ArgMatcher::new(vec![], SedonaType::Arrow(DataType::Boolean)),
342333
Volatility::Immutable,
343-
None,
344334
);
345335

346336
// We registered the stub with zero arguments, so when we call it

rust/sedona-expr/src/function_set.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,7 @@ mod tests {
170170
Arc::new(|_, _| Ok(ColumnarValue::Scalar(ScalarValue::Boolean(None)))),
171171
);
172172

173-
let udf = SedonaScalarUDF::new(
174-
"simple_udf",
175-
vec![kernel.clone()],
176-
Volatility::Immutable,
177-
None,
178-
);
173+
let udf = SedonaScalarUDF::new("simple_udf", vec![kernel.clone()], Volatility::Immutable);
179174

180175
functions.insert_scalar_udf(udf);
181176
assert_eq!(functions.scalar_udfs().collect::<Vec<_>>().len(), 1);
@@ -201,7 +196,7 @@ mod tests {
201196
Arc::new(|_, _| Ok(ColumnarValue::Scalar(ScalarValue::Utf8(None)))),
202197
);
203198

204-
let udf2 = SedonaScalarUDF::new("simple_udf2", vec![kernel2], Volatility::Immutable, None);
199+
let udf2 = SedonaScalarUDF::new("simple_udf2", vec![kernel2], Volatility::Immutable);
205200
let mut functions2 = FunctionSet::new();
206201
functions2.insert_scalar_udf(udf2);
207202
functions.merge(functions2);
@@ -252,7 +247,6 @@ mod tests {
252247
"simple_udaf",
253248
Vec::<SedonaAccumulatorRef>::new(),
254249
Volatility::Immutable,
255-
None,
256250
);
257251
let kernel = TestAccumulator {};
258252

@@ -278,7 +272,6 @@ mod tests {
278272
"simple_udaf2",
279273
vec![Arc::new(kernel.clone())],
280274
Volatility::Immutable,
281-
None,
282275
);
283276
let mut functions2 = FunctionSet::new();
284277
functions2.insert_aggregate_udf(udaf2);

rust/sedona-expr/src/scalar_udf.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub struct SedonaScalarUDF {
7070
name: String,
7171
signature: Signature,
7272
kernels: Vec<ScalarKernelRef>,
73-
documentation: Option<Documentation>,
7473
aliases: Vec<String>,
7574
}
7675

@@ -185,14 +184,12 @@ impl SedonaScalarUDF {
185184
name: &str,
186185
kernels: Vec<ScalarKernelRef>,
187186
volatility: Volatility,
188-
documentation: Option<Documentation>,
189187
) -> SedonaScalarUDF {
190188
let signature = Signature::user_defined(volatility);
191189
Self {
192190
name: name.to_string(),
193191
signature,
194192
kernels,
195-
documentation,
196193
aliases: vec![],
197194
}
198195
}
@@ -203,7 +200,6 @@ impl SedonaScalarUDF {
203200
name: self.name,
204201
signature: self.signature,
205202
kernels: self.kernels,
206-
documentation: self.documentation,
207203
aliases,
208204
}
209205
}
@@ -214,12 +210,7 @@ impl SedonaScalarUDF {
214210
/// arguments. This is useful to create stub functions when it is expected that the
215211
/// actual functionality will be registered from one or more independent crates
216212
/// (e.g., ST_Intersects(), which may be implemented in sedona-geo or sedona-geography).
217-
pub fn new_stub(
218-
name: &str,
219-
arg_matcher: ArgMatcher,
220-
volatility: Volatility,
221-
documentation: Option<Documentation>,
222-
) -> Self {
213+
pub fn new_stub(name: &str, arg_matcher: ArgMatcher, volatility: Volatility) -> Self {
223214
let name_string = name.to_string();
224215
let stub_kernel = SimpleSedonaScalarKernel::new_ref(
225216
arg_matcher,
@@ -228,7 +219,7 @@ impl SedonaScalarUDF {
228219
}),
229220
);
230221

231-
Self::new(name, vec![stub_kernel], volatility, documentation)
222+
Self::new(name, vec![stub_kernel], volatility)
232223
}
233224

234225
/// Create a SedonaScalarUDF from a single kernel
@@ -240,7 +231,6 @@ impl SedonaScalarUDF {
240231
name,
241232
kernels.into_scalar_kernel_refs(),
242233
Volatility::Immutable,
243-
None,
244234
)
245235
}
246236

@@ -284,7 +274,7 @@ impl ScalarUDFImpl for SedonaScalarUDF {
284274
}
285275

286276
fn documentation(&self) -> Option<&Documentation> {
287-
self.documentation.as_ref()
277+
None
288278
}
289279

290280
fn return_type(&self, _args: &[DataType]) -> Result<DataType> {
@@ -355,7 +345,7 @@ mod tests {
355345
#[test]
356346
fn udf_empty() -> Result<()> {
357347
// UDF with no implementations
358-
let udf = SedonaScalarUDF::new("empty", vec![], Volatility::Immutable, None);
348+
let udf = SedonaScalarUDF::new("empty", vec![], Volatility::Immutable);
359349
assert_eq!(udf.name(), "empty");
360350
assert_eq!(udf.coerce_types(&[])?, vec![]);
361351

@@ -397,7 +387,6 @@ mod tests {
397387
"simple_udf",
398388
vec![kernel_geo, kernel_arrow],
399389
Volatility::Immutable,
400-
None,
401390
);
402391

403392
// Calling with a geo type should return a Null type
@@ -443,7 +432,6 @@ mod tests {
443432
"stubby",
444433
ArgMatcher::new(vec![], SedonaType::Arrow(DataType::Boolean)),
445434
Volatility::Immutable,
446-
None,
447435
);
448436
let tester = ScalarUdfTester::new(stub.into(), vec![]);
449437
tester.assert_return_type(DataType::Boolean);
@@ -465,7 +453,6 @@ mod tests {
465453
SedonaType::Arrow(DataType::Boolean),
466454
),
467455
Volatility::Immutable,
468-
None,
469456
);
470457

471458
// None CRS to None CRS is OK
@@ -498,7 +485,6 @@ mod tests {
498485
WKB_GEOMETRY,
499486
),
500487
Volatility::Immutable,
501-
None,
502488
);
503489

504490
let tester = ScalarUdfTester::new(

rust/sedona-functions/src/barrier.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn barrier_udf() -> SedonaScalarUDF {
3131
"barrier",
3232
vec![Arc::new(Barrier)],
3333
Volatility::Volatile, // Mark as volatile to prevent optimization
34-
None,
3534
)
3635
}
3736

rust/sedona-functions/src/distance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ pub fn distance_stub_udf(name: &str) -> SedonaScalarUDF {
6060
SedonaType::Arrow(DataType::Float64),
6161
),
6262
Volatility::Immutable,
63-
None,
6463
)
6564
}
6665

0 commit comments

Comments
 (0)