diff --git a/docs/reference/sql/barrier.qmd b/docs/reference/sql/barrier.qmd new file mode 100644 index 000000000..862a7dd50 --- /dev/null +++ b/docs/reference/sql/barrier.qmd @@ -0,0 +1,89 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: barrier +description: > + Creates an optimization barrier that prevents filter pushdown by evaluating + boolean expressions at runtime. +kernels: + - returns: boolean + args: + - name: expression + type: string + - name: col_name + type: string + - name: col_value + type: any +--- + +## Description + +`barrier()` evaluates a boolean expression string at runtime using bound column +values, and is marked as volatile to prevent the query optimizer from reordering +or pushing filters past it. + +The first argument is a boolean expression string. After that, arguments come in +pairs of `(column_name, column_value)` that bind variables used in the +expression. + +### Supported expression syntax + +- **Comparison operators**: `=`, `==`, `!=`, `<>`, `>`, `>=`, `<`, `<=` +- **Logical operators**: `AND` / `and`, `OR` / `or` +- **Literal types**: integers, floats, single- or double-quoted strings, `true`, `false`, `null` +- Unrecognized expressions evaluate to `false` +- `NULL` comparisons evaluate to `false` + +### When to use + +Use `barrier()` when you need a predicate to be evaluated **after** a join or +scan rather than being pushed down by the optimizer. This is useful when the +predicate depends on values that are only available at a specific stage of +query execution. + +## Examples + +Filter rows using bound column values: + +```sql +SELECT * +FROM (VALUES (150, 'active'), (50, 'active'), (200, 'closed')) AS orders(amount, status) +WHERE barrier('amount > 100 AND status = "active"', + 'amount', amount, + 'status', status); +``` + +Combine multiple conditions with different data types: + +```sql +SELECT * +FROM (VALUES (29.99, 'electronics'), (9.99, 'books'), (49.99, 'electronics')) AS products(price, category) +WHERE barrier('price > 19.99 AND category = "electronics"', + 'price', price, + 'category', category); +``` + +Use `OR` logic: + +```sql +SELECT * +FROM (VALUES (3, 'info'), (7, 'critical'), (10, 'warning')) AS events(priority, type) +WHERE barrier('priority < 5 OR type = "critical"', + 'priority', priority, + 'type', type); +``` diff --git a/docs/reference/sql/rs_convexhull.qmd b/docs/reference/sql/rs_convexhull.qmd new file mode 100644 index 000000000..7e9cfd9df --- /dev/null +++ b/docs/reference/sql/rs_convexhull.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_ConvexHull +description: Return the convex hull geometry of a raster. +kernels: + - returns: geometry + args: [raster] +--- + +## Examples + +```sql +SELECT RS_ConvexHull(RS_Example()); +``` diff --git a/docs/reference/sql/rs_crs.qmd b/docs/reference/sql/rs_crs.qmd new file mode 100644 index 000000000..741ce4397 --- /dev/null +++ b/docs/reference/sql/rs_crs.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_CRS +description: Return the CRS string for a raster. +kernels: + - returns: string + args: [raster] +--- + +## Examples + +```sql +SELECT RS_CRS(RS_Example()); +``` diff --git a/docs/reference/sql/rs_envelope.qmd b/docs/reference/sql/rs_envelope.qmd new file mode 100644 index 000000000..e2d284e6b --- /dev/null +++ b/docs/reference/sql/rs_envelope.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_Envelope +description: Return the envelope (bounding box) of a raster as a geometry. +kernels: + - returns: geometry + args: [raster] +--- + +## Examples + +```sql +SELECT RS_Envelope(RS_Example()); +``` diff --git a/docs/reference/sql/rs_example.qmd b/docs/reference/sql/rs_example.qmd new file mode 100644 index 000000000..50db25b5c --- /dev/null +++ b/docs/reference/sql/rs_example.qmd @@ -0,0 +1,24 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_Example +description: Create a simple example raster for testing and demos. +kernels: + - returns: raster + args: [] +--- diff --git a/docs/reference/sql/rs_height.qmd b/docs/reference/sql/rs_height.qmd new file mode 100644 index 000000000..6af0d3f88 --- /dev/null +++ b/docs/reference/sql/rs_height.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_Height +description: Return the height of a raster in pixels. +kernels: + - returns: bigint + args: [raster] +--- + +## Examples + +```sql +SELECT RS_Height(RS_Example()); +``` diff --git a/docs/reference/sql/rs_rastertoworldcoord.qmd b/docs/reference/sql/rs_rastertoworldcoord.qmd new file mode 100644 index 000000000..5ddf3ec4a --- /dev/null +++ b/docs/reference/sql/rs_rastertoworldcoord.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_RasterToWorldCoord +description: Convert raster pixel coordinates to world coordinates as a point. +kernels: + - returns: geometry + args: + - raster + - name: x + type: integer + - name: y + type: integer +--- + +## Examples + +```sql +SELECT RS_RasterToWorldCoord(RS_Example(), 10, 20); +``` diff --git a/docs/reference/sql/rs_rastertoworldcoordx.qmd b/docs/reference/sql/rs_rastertoworldcoordx.qmd new file mode 100644 index 000000000..bf8640656 --- /dev/null +++ b/docs/reference/sql/rs_rastertoworldcoordx.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_RasterToWorldCoordX +description: Convert raster pixel coordinates to world X coordinate. +kernels: + - returns: double + args: + - raster + - name: x + type: integer + - name: y + type: integer +--- + +## Examples + +```sql +SELECT RS_RasterToWorldCoordX(RS_Example(), 10, 20); +``` diff --git a/docs/reference/sql/rs_rastertoworldcoordy.qmd b/docs/reference/sql/rs_rastertoworldcoordy.qmd new file mode 100644 index 000000000..7f400ccd4 --- /dev/null +++ b/docs/reference/sql/rs_rastertoworldcoordy.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_RasterToWorldCoordY +description: Convert raster pixel coordinates to world Y coordinate. +kernels: + - returns: double + args: + - raster + - name: x + type: integer + - name: y + type: integer +--- + +## Examples + +```sql +SELECT RS_RasterToWorldCoordY(RS_Example(), 10, 20); +``` diff --git a/docs/reference/sql/rs_rotation.qmd b/docs/reference/sql/rs_rotation.qmd new file mode 100644 index 000000000..fd3e88c8c --- /dev/null +++ b/docs/reference/sql/rs_rotation.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_Rotation +description: Return the raster rotation in radians based on skew parameters. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_Rotation(RS_Example()); +``` diff --git a/docs/reference/sql/rs_scalex.qmd b/docs/reference/sql/rs_scalex.qmd new file mode 100644 index 000000000..aa15bf8a1 --- /dev/null +++ b/docs/reference/sql/rs_scalex.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_ScaleX +description: Return the pixel width (scale X) of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_ScaleX(RS_Example()); +``` diff --git a/docs/reference/sql/rs_scaley.qmd b/docs/reference/sql/rs_scaley.qmd new file mode 100644 index 000000000..5baf240fa --- /dev/null +++ b/docs/reference/sql/rs_scaley.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_ScaleY +description: Return the pixel height (scale Y) of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_ScaleY(RS_Example()); +``` diff --git a/docs/reference/sql/rs_skewx.qmd b/docs/reference/sql/rs_skewx.qmd new file mode 100644 index 000000000..0e774b928 --- /dev/null +++ b/docs/reference/sql/rs_skewx.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_SkewX +description: Return the X skew (rotation) parameter of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_SkewX(RS_Example()); +``` diff --git a/docs/reference/sql/rs_skewy.qmd b/docs/reference/sql/rs_skewy.qmd new file mode 100644 index 000000000..f77590c64 --- /dev/null +++ b/docs/reference/sql/rs_skewy.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_SkewY +description: Return the Y skew (rotation) parameter of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_SkewY(RS_Example()); +``` diff --git a/docs/reference/sql/rs_srid.qmd b/docs/reference/sql/rs_srid.qmd new file mode 100644 index 000000000..81a018503 --- /dev/null +++ b/docs/reference/sql/rs_srid.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_SRID +description: Return the SRID of a raster. +kernels: + - returns: integer + args: [raster] +--- + +## Examples + +```sql +SELECT RS_SRID(RS_Example()); +``` diff --git a/docs/reference/sql/rs_upperleftx.qmd b/docs/reference/sql/rs_upperleftx.qmd new file mode 100644 index 000000000..0a98f3b04 --- /dev/null +++ b/docs/reference/sql/rs_upperleftx.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_UpperLeftX +description: Return the upper-left X coordinate of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_UpperLeftX(RS_Example()); +``` diff --git a/docs/reference/sql/rs_upperlefty.qmd b/docs/reference/sql/rs_upperlefty.qmd new file mode 100644 index 000000000..0a9114a97 --- /dev/null +++ b/docs/reference/sql/rs_upperlefty.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_UpperLeftY +description: Return the upper-left Y coordinate of a raster. +kernels: + - returns: double + args: [raster] +--- + +## Examples + +```sql +SELECT RS_UpperLeftY(RS_Example()); +``` diff --git a/docs/reference/sql/rs_width.qmd b/docs/reference/sql/rs_width.qmd new file mode 100644 index 000000000..0e8c9a7dc --- /dev/null +++ b/docs/reference/sql/rs_width.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_Width +description: Return the width of a raster in pixels. +kernels: + - returns: bigint + args: [raster] +--- + +## Examples + +```sql +SELECT RS_Width(RS_Example()); +``` diff --git a/docs/reference/sql/rs_worldtorastercoord.qmd b/docs/reference/sql/rs_worldtorastercoord.qmd new file mode 100644 index 000000000..59e73f1a5 --- /dev/null +++ b/docs/reference/sql/rs_worldtorastercoord.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_WorldToRasterCoord +description: Convert world coordinates to raster coordinates as a point. +kernels: + - returns: geometry + args: + - raster + - name: x + type: double + - name: y + type: double +--- + +## Examples + +```sql +SELECT RS_WorldToRasterCoord(RS_Example(), 10.0, 20.0); +``` diff --git a/docs/reference/sql/rs_worldtorastercoordx.qmd b/docs/reference/sql/rs_worldtorastercoordx.qmd new file mode 100644 index 000000000..65e5eebbe --- /dev/null +++ b/docs/reference/sql/rs_worldtorastercoordx.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_WorldToRasterCoordX +description: Convert world coordinates to raster X coordinate. +kernels: + - returns: integer + args: + - raster + - name: x + type: double + - name: y + type: double +--- + +## Examples + +```sql +SELECT RS_WorldToRasterCoordX(RS_Example(), 10.0, 20.0); +``` diff --git a/docs/reference/sql/rs_worldtorastercoordy.qmd b/docs/reference/sql/rs_worldtorastercoordy.qmd new file mode 100644 index 000000000..57ea948f0 --- /dev/null +++ b/docs/reference/sql/rs_worldtorastercoordy.qmd @@ -0,0 +1,35 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: RS_WorldToRasterCoordY +description: Convert world coordinates to raster Y coordinate. +kernels: + - returns: integer + args: + - raster + - name: x + type: double + - name: y + type: double +--- + +## Examples + +```sql +SELECT RS_WorldToRasterCoordY(RS_Example(), 10.0, 20.0); +``` diff --git a/docs/reference/sql/sd_format.qmd b/docs/reference/sql/sd_format.qmd new file mode 100644 index 000000000..fa75a4eeb --- /dev/null +++ b/docs/reference/sql/sd_format.qmd @@ -0,0 +1,38 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: SD_Format +description: Format values for display with optional JSON options. +kernels: + - returns: any + args: + - name: value + type: any + - name: options + type: string +--- + +## Description + +Returns a formatted representation of the input value. When `options` is provided, it should be a JSON string containing formatting hints such as `width_hint`. + +## Examples + +```sql +SELECT SD_Format(ST_Point(1.0, 2.0), '{"width_hint": 16}'); +``` diff --git a/docs/reference/sql/sd_order.qmd b/docs/reference/sql/sd_order.qmd new file mode 100644 index 000000000..fadfb6e44 --- /dev/null +++ b/docs/reference/sql/sd_order.qmd @@ -0,0 +1,45 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: SD_Order +description: Return a value suitable for ordering or sorting. +kernels: + - returns: any + args: + - name: value + type: any +--- + +## Examples + +```sql +SELECT city, geom, SD_Order(geom) +FROM ( + VALUES + ('San Francisco', ST_Point(-122.4194, 37.7749)), + ('Los Angeles', ST_Point(-118.2437, 34.0522)), + ('New York', ST_Point(-73.9857, 40.7484)), + ('Chicago', ST_Point(-87.6298, 41.8781)), + ('Houston', ST_Point(-95.3698, 29.7604)), + ('Phoenix', ST_Point(-112.0740, 33.4484)), + ('Portland', ST_Point(-122.6765, 45.5231)), + ('Miami', ST_Point(-80.1918, 25.7617)), + ('Denver', ST_Point(-104.9903, 39.7392)), + ('Boston', ST_Point(-71.0589, 42.3601)) +) AS my_table(city, geom); +``` diff --git a/docs/reference/sql/st_affine.qmd b/docs/reference/sql/st_affine.qmd new file mode 100644 index 000000000..1a5211cb9 --- /dev/null +++ b/docs/reference/sql/st_affine.qmd @@ -0,0 +1,72 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Affine +description: Apply an affine transformation to a geometry. +kernels: + - returns: geometry + args: + - name: geom + type: geometry + - name: a + type: double + - name: b + type: double + - name: d + type: double + - name: e + type: double + - name: xOff + type: double + - name: yOff + type: double + - returns: geometry + args: + - name: geom + type: geometry + - name: a + type: double + - name: b + type: double + - name: c + type: double + - name: d + type: double + - name: e + type: double + - name: f + type: double + - name: g + type: double + - name: h + type: double + - name: i + type: double + - name: xOff + type: double + - name: yOff + type: double + - name: zOff + type: double +--- + +## Examples + +```sql +SELECT ST_AsText(ST_Affine(ST_GeomFromText('POINT (1 2)'), 1, 0, 0, 1, 10, 20)); +``` diff --git a/docs/reference/sql/st_asewkb.qmd b/docs/reference/sql/st_asewkb.qmd new file mode 100644 index 000000000..fd73ccda6 --- /dev/null +++ b/docs/reference/sql/st_asewkb.qmd @@ -0,0 +1,34 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_AsEWKB +description: Return the EWKB representation of a geometry or geography. +kernels: + - returns: binary + args: [geometry] +--- + +## Description + +EWKB extends WKB to include SRID information in the binary header and is useful for PostGIS compatibility. This function preserves item-level CRSes or will repeat a type-level CRS for all elements if present. + +## Examples + +```sql +SELECT ST_AsEWKB(ST_Point(1.0, 2.0, 4326)); +``` diff --git a/docs/reference/sql/st_asgeojson.qmd b/docs/reference/sql/st_asgeojson.qmd new file mode 100644 index 000000000..77f26bb12 --- /dev/null +++ b/docs/reference/sql/st_asgeojson.qmd @@ -0,0 +1,30 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_AsGeoJSON +description: Return the GeoJSON representation of a geometry. +kernels: + - returns: string + args: [geometry] +--- + +## Examples + +```sql +SELECT ST_AsGeoJSON(ST_Point(1.0, 2.0)); +``` diff --git a/docs/reference/sql/st_azimuth.qmd b/docs/reference/sql/st_azimuth.qmd index ec2aaefde..123257096 100644 --- a/docs/reference/sql/st_azimuth.qmd +++ b/docs/reference/sql/st_azimuth.qmd @@ -23,6 +23,11 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns the azimuth (angle) from the first point to the second point, measured in +**radians** clockwise from north. Returns NULL if either input is not a point. + ## Examples ```sql diff --git a/docs/reference/sql/st_boundary.qmd b/docs/reference/sql/st_boundary.qmd index dff332566..87038ee6c 100644 --- a/docs/reference/sql/st_boundary.qmd +++ b/docs/reference/sql/st_boundary.qmd @@ -23,6 +23,10 @@ kernels: args: [geometry] --- +## Description + +For a polygon, the boundary is the exterior and interior rings; for a linestring it is the endpoints. + ## Examples ```sql diff --git a/docs/reference/sql/st_centroid.qmd b/docs/reference/sql/st_centroid.qmd index 63c55f9d5..fa7e975f6 100644 --- a/docs/reference/sql/st_centroid.qmd +++ b/docs/reference/sql/st_centroid.qmd @@ -26,5 +26,7 @@ kernels: ## Examples ```sql -SELECT ST_AsText(ST_Centroid(ST_GeomFromWKT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'))); +SELECT ST_Centroid( + ST_GeomFromWKT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') +); ``` diff --git a/docs/reference/sql/st_closestpoint.qmd b/docs/reference/sql/st_closestpoint.qmd index 8a6490a12..8377a1be5 100644 --- a/docs/reference/sql/st_closestpoint.qmd +++ b/docs/reference/sql/st_closestpoint.qmd @@ -21,15 +21,15 @@ description: Returns the 2-dimensional point on geom1 that is closest to geom2. kernels: - returns: geometry args: [geometry, geometry] + - returns: geography + args: [geography, geography] --- ## Examples ```sql -SELECT ST_AsText( - ST_ClosestPoint( - ST_GeogFromText('POINT(-118.4 34.0)'), -- Santa Monica - ST_GeogFromText('LINESTRING(-118.5 34.1, -118.3 33.9, -118.2 33.8)') -- LA coastline - ) -) As ptwkt; +SELECT ST_ClosestPoint( + ST_GeogFromText('LINESTRING(0 0, 10 10)'), + ST_GeogPoint(5, 0) +); ``` diff --git a/docs/reference/sql/st_collect_agg.qmd b/docs/reference/sql/st_collect_agg.qmd index 85db40275..220dfb228 100644 --- a/docs/reference/sql/st_collect_agg.qmd +++ b/docs/reference/sql/st_collect_agg.qmd @@ -23,15 +23,20 @@ kernels: args: [geometry] --- +## Description + +An aggregate function that collects multiple geometries into a single +GeometryCollection or the appropriate Multi-type if all inputs share the same +geometry type. + ## Examples ```sql -SELECT ST_Collect_Agg(geom) as collected_points +SELECT ST_Collect_Agg(geom) AS collected_points FROM ( - SELECT ST_Point(-122.4194, 37.7749) as geom -- San Francisco - UNION ALL - SELECT ST_Point(-118.2437, 34.0522) -- Los Angeles - UNION ALL - SELECT ST_Point(-122.6765, 45.5231) -- Portland -) as cities; + VALUES + (ST_Point(-122.4194, 37.7749)), + (ST_Point(-118.2437, 34.0522)), + (ST_Point(-122.6765, 45.5231)) +) AS cities(geom); ``` diff --git a/docs/reference/sql/st_concavehull.qmd b/docs/reference/sql/st_concavehull.qmd new file mode 100644 index 000000000..e79d2a899 --- /dev/null +++ b/docs/reference/sql/st_concavehull.qmd @@ -0,0 +1,43 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_ConcaveHull +description: Return a concave hull enclosing the input geometry. +kernels: + - returns: geometry + args: + - name: geom + type: geometry + - name: pct_convex + type: double +--- + +## Description + +Returns a concave hull enclosing the input geometry. The `pct_convex` parameter +controls how "tight" the hull is: 1.0 produces the convex hull, while smaller +values produce tighter, more concave shapes. + +## Examples + +```sql +SELECT ST_ConcaveHull( + ST_GeomFromText('LINESTRING(100 150, 50 60, 70 80, 160 170)'), + 0.3 +); +``` diff --git a/docs/reference/sql/st_contains.qmd b/docs/reference/sql/st_contains.qmd index 28ba797d5..699a4f288 100644 --- a/docs/reference/sql/st_contains.qmd +++ b/docs/reference/sql/st_contains.qmd @@ -23,11 +23,15 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if no points of B lie outside A and at least one point of B lies inside A. + ## Examples ```sql SELECT ST_Contains( - ST_Point(0.25, 0.25), - ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))') + ST_GeomFromText('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'), + ST_Point(0.25, 0.25) ) AS val; ``` diff --git a/docs/reference/sql/st_convexhull.qmd b/docs/reference/sql/st_convexhull.qmd index 218d4cc8f..0c09d039b 100644 --- a/docs/reference/sql/st_convexhull.qmd +++ b/docs/reference/sql/st_convexhull.qmd @@ -23,8 +23,14 @@ kernels: args: [geometry] --- +## Description + +Returns the smallest convex polygon that encloses all points in the input geometry. + ## Examples ```sql -SELECT ST_ConvexHull(ST_GeomFromText('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))')); +SELECT ST_ConvexHull( + ST_GeomFromText('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))') +); ``` diff --git a/docs/reference/sql/st_coveredby.qmd b/docs/reference/sql/st_coveredby.qmd index 629e1fc1a..f7ae1ef34 100644 --- a/docs/reference/sql/st_coveredby.qmd +++ b/docs/reference/sql/st_coveredby.qmd @@ -23,8 +23,16 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if no point in geometry A is outside geometry B. Inverse of +`ST_Covers`: `ST_CoveredBy(A, B)` is equivalent to `ST_Covers(B, A)`. + ## Examples ```sql -SELECT ST_CoveredBy(ST_Point(0.25, 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')); +SELECT ST_CoveredBy( + ST_Point(0.25, 0.25), + ST_GeomFromText('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))') +); ``` diff --git a/docs/reference/sql/st_covers.qmd b/docs/reference/sql/st_covers.qmd index c62577d90..399b7b31b 100644 --- a/docs/reference/sql/st_covers.qmd +++ b/docs/reference/sql/st_covers.qmd @@ -23,8 +23,16 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if no point in geometry B is outside geometry A. Similar to +`ST_Contains` but does not require interior intersection. + ## Examples ```sql -SELECT ST_Covers(ST_Point(0.25, 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) AS val; +SELECT ST_Covers( + ST_GeomFromText('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'), + ST_Point(0.25, 0.25) +) AS val; ``` diff --git a/docs/reference/sql/st_crosses.qmd b/docs/reference/sql/st_crosses.qmd index 1ae17931d..04476dc0d 100644 --- a/docs/reference/sql/st_crosses.qmd +++ b/docs/reference/sql/st_crosses.qmd @@ -23,8 +23,16 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if the two geometries have some (but not all) interior points in +common and the dimension of the intersection is less than that of either input. + ## Examples ```sql -SELECT ST_Crosses(ST_GeomFromWKT('POLYGON((1 1, 4 1, 4 4, 1 4, 1 1))'),ST_GeomFromWKT('POLYGON((2 2, 5 2, 5 5, 2 5, 2 2))')); +SELECT ST_Crosses( + ST_GeomFromWKT('LINESTRING(0 0, 2 2)'), + ST_GeomFromWKT('LINESTRING(0 2, 2 0)') +); ``` diff --git a/docs/reference/sql/st_crs.qmd b/docs/reference/sql/st_crs.qmd index cc2bca9af..b80bdad89 100644 --- a/docs/reference/sql/st_crs.qmd +++ b/docs/reference/sql/st_crs.qmd @@ -23,8 +23,13 @@ kernels: args: [geometry] --- +## Description + +Returns the CRS (Coordinate Reference System) string associated with a geometry +or geography. This is abbreviated as an authority/code if possible (e.g., `'EPSG:3857'`). + ## Examples ```sql -SELECT ST_CRS(ST_Point(0.25, 0.25, 4326)) as crs_info; +SELECT ST_CRS(ST_Point(0.25, 0.25, 4326)) AS crs_info; ``` diff --git a/docs/reference/sql/st_difference.qmd b/docs/reference/sql/st_difference.qmd index 8ec890a4d..884bce536 100644 --- a/docs/reference/sql/st_difference.qmd +++ b/docs/reference/sql/st_difference.qmd @@ -23,6 +23,10 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns the part of geometry A that does not intersect with geometry B. + ## Examples ```sql diff --git a/docs/reference/sql/st_dimension.qmd b/docs/reference/sql/st_dimension.qmd index 30b10ca25..3fe9ba686 100644 --- a/docs/reference/sql/st_dimension.qmd +++ b/docs/reference/sql/st_dimension.qmd @@ -23,8 +23,22 @@ kernels: args: [geometry] --- +## Description + +Returns the inherent dimension of the geometry: + +- 0 for points or multipoints +- 1 for linestring or multilinestrings +- 2 for polygons or multipolygons + +For geometry collections, returns the largest dimension among the components. + ## Examples ```sql SELECT ST_Dimension(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))')); ``` + +```sql +SELECT ST_Dimension(ST_Point(1.0, 2.0)); +``` diff --git a/docs/reference/sql/st_disjoint.qmd b/docs/reference/sql/st_disjoint.qmd index 0653e5d7c..926bf9a9c 100644 --- a/docs/reference/sql/st_disjoint.qmd +++ b/docs/reference/sql/st_disjoint.qmd @@ -23,8 +23,15 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if the two geometries do not share any points. This is the inverse of `ST_Intersects`. + ## Examples ```sql -SELECT ST_Disjoint(ST_Point(0.25, 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) AS val; +SELECT ST_Disjoint( + ST_Point(0.25, 0.25), + ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))') +) AS val; ``` diff --git a/docs/reference/sql/st_distance.qmd b/docs/reference/sql/st_distance.qmd new file mode 100644 index 000000000..f338fb1d9 --- /dev/null +++ b/docs/reference/sql/st_distance.qmd @@ -0,0 +1,36 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Distance +description: Return the distance between two geometries or geographies. +kernels: + - returns: double + args: [geometry, geometry] +--- + +## Description + +Returns the 2D Cartesian (planar) distance between two geometries, in the units +of the coordinate reference system. For geographic distance calculations, use +`ST_DistanceSphere` or `ST_DistanceSpheroid`. + +## Examples + +```sql +SELECT ST_Distance(ST_Point(0, 0), ST_Point(1, 1)); +``` diff --git a/docs/reference/sql/st_endpoint.qmd b/docs/reference/sql/st_endpoint.qmd index 383a4adac..f5f35871e 100644 --- a/docs/reference/sql/st_endpoint.qmd +++ b/docs/reference/sql/st_endpoint.qmd @@ -26,5 +26,5 @@ kernels: ## Examples ```sql -SELECT ST_EndPoint(ST_GeomFromText('LINESTRING(100 150,50 60, 70 80, 160 170)')); +SELECT ST_EndPoint(ST_GeomFromText('LINESTRING(100 150, 50 60, 70 80, 160 170)')); ``` diff --git a/docs/reference/sql/st_envelope.qmd b/docs/reference/sql/st_envelope.qmd index 7befdedaf..8f97a246b 100644 --- a/docs/reference/sql/st_envelope.qmd +++ b/docs/reference/sql/st_envelope.qmd @@ -23,8 +23,16 @@ kernels: args: [geometry] --- +## Description + +Returns the minimum axis-aligned bounding box of a geometry. This is usually a polygon but can be a linestring for perfectly vertical or horizontal input. + ## Examples +```sql +SELECT ST_Envelope(ST_GeomFromWKT('LINESTRING(0 0, 3 4)')); +``` + ```sql SELECT ST_Envelope(ST_Point(1.0, 2.0)); ``` diff --git a/docs/reference/sql/st_envelope_agg.qmd b/docs/reference/sql/st_envelope_agg.qmd index c0c38c1be..5e825ff20 100644 --- a/docs/reference/sql/st_envelope_agg.qmd +++ b/docs/reference/sql/st_envelope_agg.qmd @@ -23,8 +23,17 @@ kernels: args: [geometry] --- +## Description + +An aggregate function that computes the collective bounding box (envelope) of all geometries in a group. + ## Examples ```sql -SELECT ST_Envelope_Agg(ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) +SELECT ST_Envelope_Agg(geom) FROM ( + VALUES + (ST_Point(0, 0)), + (ST_Point(5, 5)), + (ST_Point(10, 2)) +) AS t(geom); ``` diff --git a/docs/reference/sql/st_equals.qmd b/docs/reference/sql/st_equals.qmd index ca074283b..a96c66b6d 100644 --- a/docs/reference/sql/st_equals.qmd +++ b/docs/reference/sql/st_equals.qmd @@ -23,11 +23,15 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if the two geometries are topologically equal (i.e., they represent the same point set, regardless of vertex order). + ## Examples ```sql SELECT ST_Equals( - ST_Point(0.25, 0.25), - ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))') + ST_GeomFromText('LINESTRING(0 0, 1 1)'), + ST_GeomFromText('LINESTRING(1 1, 0 0)') ); ``` diff --git a/docs/reference/sql/st_flipcoordinates.qmd b/docs/reference/sql/st_flipcoordinates.qmd index 077f96db8..4f2399fe3 100644 --- a/docs/reference/sql/st_flipcoordinates.qmd +++ b/docs/reference/sql/st_flipcoordinates.qmd @@ -21,6 +21,8 @@ description: Returns a new geometry with the X and Y coordinates of each vertex kernels: - returns: geometry args: [geometry] + - returns: geography + args: [geography] --- ## Examples diff --git a/docs/reference/sql/st_force2d.qmd b/docs/reference/sql/st_force2d.qmd new file mode 100644 index 000000000..21ecb1d31 --- /dev/null +++ b/docs/reference/sql/st_force2d.qmd @@ -0,0 +1,34 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Force2D +description: Force a geometry into a XY coordinate model. +kernels: + - returns: geometry + args: [geometry] +--- + +## Description + +Discards any Z and M values present (if any). + +## Examples + +```sql +SELECT ST_Force2D(ST_GeomFromWKT('POINT Z (1 2 3)')); +``` diff --git a/docs/reference/sql/st_force3d.qmd b/docs/reference/sql/st_force3d.qmd new file mode 100644 index 000000000..2a4f4351e --- /dev/null +++ b/docs/reference/sql/st_force3d.qmd @@ -0,0 +1,47 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Force3D +description: Force a geometry into a XYZ coordinate model with an optional Z value. +kernels: + - returns: geometry + args: [geometry] + - returns: geometry + args: + - geometry + - name: z + type: double +--- + +## Description + +If the geometry already has Z values they are preserved; otherwise the optional `z` argument (default 0) is used. + +## Examples + +```sql +SELECT ST_Force3D(ST_GeomFromWKT('POINT (1 2)'), 10.0); +``` + +```sql +SELECT ST_Force3D(ST_GeomFromWKT('POINT (1 2)')); +``` + +```sql +SELECT ST_Force3D(ST_GeomFromWKT('POINT Z (1 2 3)'), 10.0); +``` diff --git a/docs/reference/sql/st_force3dm.qmd b/docs/reference/sql/st_force3dm.qmd new file mode 100644 index 000000000..9a8975bf7 --- /dev/null +++ b/docs/reference/sql/st_force3dm.qmd @@ -0,0 +1,47 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Force3DM +description: Force a geometry into a XYM coordinate model with an optional M value. +kernels: + - returns: geometry + args: [geometry] + - returns: geometry + args: + - geometry + - name: m + type: double +--- + +## Description + +If the geometry already has M values they are preserved; otherwise the optional `m` argument (default 0) is used. + +## Examples + +```sql +SELECT ST_Force3DM(ST_GeomFromWKT('POINT (1 2)'), 10.0); +``` + +```sql +SELECT ST_Force3DM(ST_GeomFromWKT('POINT (1 2)')); +``` + +```sql +SELECT ST_Force3DM(ST_GeomFromWKT('POINT M (1 2 3)'), 10.0); +``` diff --git a/docs/reference/sql/st_force4d.qmd b/docs/reference/sql/st_force4d.qmd new file mode 100644 index 000000000..cda9fa98c --- /dev/null +++ b/docs/reference/sql/st_force4d.qmd @@ -0,0 +1,58 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Force4D +description: Force a geometry into a XYZM coordinate model with optional Z and M values. +kernels: + - returns: geometry + args: [geometry] + - returns: geometry + args: + - geometry + - name: z + type: double + - returns: geometry + args: + - geometry + - name: z + type: double + - name: m + type: double +--- + +## Description + +If the geometry already has Z and M values they are preserved; otherwise optional `z` and `m` arguments (both default 0) are used. + +## Examples + +```sql +SELECT ST_Force4D(ST_GeomFromWKT('POINT (1 2)'), 10.0, 20.0); +``` + +```sql +SELECT ST_Force4D(ST_GeomFromWKT('POINT (1 2)'), 10.0); +``` + +```sql +SELECT ST_Force4D(ST_GeomFromWKT('POINT (1 2)')); +``` + +```sql +SELECT ST_Force4D(ST_GeomFromWKT('POINT ZM (1 2 3 4)'), 10.0, 20.0); +``` diff --git a/docs/reference/sql/st_geogfromwkb.qmd b/docs/reference/sql/st_geogfromwkb.qmd index 372664e78..0f5eaa908 100644 --- a/docs/reference/sql/st_geogfromwkb.qmd +++ b/docs/reference/sql/st_geogfromwkb.qmd @@ -28,5 +28,7 @@ kernels: ## Examples ```sql -SELECT ST_GeogFromWKB(decode('010200000002000000000000000084d600c0000000000080b5d6bf00000060e1eff7bf00000080075de5bf', 'hex')); +SELECT ST_GeogFromWKB( + x'010200000002000000000000000084d600c0000000000080b5d6bf00000060e1eff7bf00000080075de5bf' +); ``` diff --git a/docs/reference/sql/st_geogpoint.qmd b/docs/reference/sql/st_geogpoint.qmd index 7ef44e5d9..0a238dafe 100644 --- a/docs/reference/sql/st_geogpoint.qmd +++ b/docs/reference/sql/st_geogpoint.qmd @@ -27,8 +27,12 @@ kernels: type: double --- +## Description + +Creates a geography Point from longitude and latitude coordinates. + ## Examples ```sql -SELECT ST_GeogPoint(10, 10), ST_GeogPoint(0, 0); +SELECT ST_GeogPoint(-64, 45); ``` diff --git a/docs/reference/sql/st_geometryn.qmd b/docs/reference/sql/st_geometryn.qmd index 6c6c78baa..4dd69f17d 100644 --- a/docs/reference/sql/st_geometryn.qmd +++ b/docs/reference/sql/st_geometryn.qmd @@ -26,8 +26,15 @@ kernels: type: integer --- +## Description + +Returns NULL if the index is out of range. + ## Examples ```sql -SELECT ST_GeometryN(ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'), 1); +SELECT ST_GeometryN( + ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'), + 1 +); ``` diff --git a/docs/reference/sql/st_geometrytype.qmd b/docs/reference/sql/st_geometrytype.qmd index 5094a9169..b87715ab1 100644 --- a/docs/reference/sql/st_geometrytype.qmd +++ b/docs/reference/sql/st_geometrytype.qmd @@ -23,8 +23,18 @@ kernels: args: [geometry] --- +## Description + +Returns the OGC geometry type name prefixed with `ST_`. Possible return values +include: `'ST_Point'`, `'ST_LineString'`, `'ST_Polygon'`, `'ST_MultiPoint'`, +`'ST_MultiLineString'`, `'ST_MultiPolygon'`, and `'ST_GeometryCollection'`. + ## Examples ```sql SELECT ST_GeometryType(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))')); ``` + +```sql +SELECT ST_GeometryType(ST_Point(1.0, 2.0)); +``` diff --git a/docs/reference/sql/st_geomfromewkb.qmd b/docs/reference/sql/st_geomfromewkb.qmd new file mode 100644 index 000000000..0ef3adf04 --- /dev/null +++ b/docs/reference/sql/st_geomfromewkb.qmd @@ -0,0 +1,36 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_GeomFromEWKB +description: Construct a geometry from Extended Well-Known Binary (EWKB). +kernels: + - returns: geometry + args: + - name: ewkb + type: binary +--- + +## Description + +Parses an EWKB binary value and returns a geometry. EWKB extends the WKB format to include SRID information in the binary header and is useful for PostGIS compatibility. + +## Examples + +```sql +SELECT ST_GeomFromEWKB(x'0101000000000000000000f03f0000000000000040'); +``` diff --git a/docs/reference/sql/st_geomfromewkt.qmd b/docs/reference/sql/st_geomfromewkt.qmd new file mode 100644 index 000000000..9c847082b --- /dev/null +++ b/docs/reference/sql/st_geomfromewkt.qmd @@ -0,0 +1,36 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_GeomFromEWKT +description: Construct a geometry from Extended Well-Known Text (EWKT). +kernels: + - returns: geometry + args: + - name: ewkt + type: string +--- + +## Description + +Parses an EWKT string in the format `SRID=;` and returns a geometry with the embedded SRID set. EWKT is used by PostGIS and other systems for human-readable output when an item-level SRID required. + +## Examples + +```sql +SELECT ST_GeomFromEWKT('SRID=4326;POINT(40.7128 -74.0060)'); +``` diff --git a/docs/reference/sql/st_geomfromwkb.qmd b/docs/reference/sql/st_geomfromwkb.qmd index b8f574c73..62c793b8a 100644 --- a/docs/reference/sql/st_geomfromwkb.qmd +++ b/docs/reference/sql/st_geomfromwkb.qmd @@ -17,19 +17,43 @@ # under the License. title: ST_GeomFromWKB -description: Construct a Geometry from WKB. +description: Construct a Geometry from Well-Known Binary (WKB). kernels: - returns: geometry args: - name: wkb type: binary + - returns: geometry + args: + - name: wkb + type: binary + - name: srid + type: crs --- +## Description + +Parses a WKB binary value and returns a geometry. The input is validated by +default. An optional SRID or CRS can be provided as a second argument. + ## Examples ```sql --- Creates a POINT(1 2) geometry from its WKB representation -SELECT ST_AsText( - ST_GeomFromWKB(decode('0101000000000000000000F03F0000000000000040', 'hex')) +SELECT ST_GeomFromWKB( + decode('0101000000000000000000F03F0000000000000040', 'hex') +); +``` + +```sql +SELECT ST_GeomFromWKB( + decode('0101000000000000000000F03F0000000000000040', 'hex'), + 4326 +); +``` + +```sql +SELECT ST_GeomFromWKB( + decode('0101000000000000000000F03F0000000000000040', 'hex'), + 'OGC:CRS27' ); ``` diff --git a/docs/reference/sql/st_geomfromwkt.qmd b/docs/reference/sql/st_geomfromwkt.qmd index 86f9fbbf1..1b8443f46 100644 --- a/docs/reference/sql/st_geomfromwkt.qmd +++ b/docs/reference/sql/st_geomfromwkt.qmd @@ -17,16 +17,36 @@ # under the License. title: ST_GeomFromWKT -description: Construct a Geometry from WKT. +description: Construct a Geometry from Well-Known Text (WKT). kernels: - returns: geometry args: - name: wkt type: string + - returns: geometry + args: + - name: wkt + type: string + - name: srid + type: crs --- +## Description + +An optional SRID or CRS can be provided as a second argument to set the spatial reference. + ## Examples ```sql SELECT ST_AsText(ST_GeomFromWKT('POINT (30 10)')); ``` + +With an SRID: + +```sql +SELECT ST_GeomFromWKT('POINT (30 10)', 4326); +``` + +```sql +SELECT ST_GeomFromWKT('POINT (30 10)', 'OGC:CRS27'); +``` diff --git a/docs/reference/sql/st_hasm.qmd b/docs/reference/sql/st_hasm.qmd index 59531fc73..3d1b9d063 100644 --- a/docs/reference/sql/st_hasm.qmd +++ b/docs/reference/sql/st_hasm.qmd @@ -26,5 +26,9 @@ kernels: ## Examples ```sql -SELECT ST_HasM(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))')); +SELECT ST_HasM(ST_GeomFromWKT('POINT M (1 2 3)')); +``` + +```sql +SELECT ST_HasM(ST_GeomFromWKT('POINT (1 2)')); ``` diff --git a/docs/reference/sql/st_hasz.qmd b/docs/reference/sql/st_hasz.qmd index 2459af847..dc45c5db3 100644 --- a/docs/reference/sql/st_hasz.qmd +++ b/docs/reference/sql/st_hasz.qmd @@ -26,5 +26,9 @@ kernels: ## Examples ```sql -SELECT ST_HasZ(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))')); +SELECT ST_HasZ(ST_GeomFromWKT('POINT Z (1 2 3)')); +``` + +```sql +SELECT ST_HasZ(ST_GeomFromWKT('POINT (1 2)')); ``` diff --git a/docs/reference/sql/st_intersection_agg.qmd b/docs/reference/sql/st_intersection_agg.qmd new file mode 100644 index 000000000..ee59b4bbb --- /dev/null +++ b/docs/reference/sql/st_intersection_agg.qmd @@ -0,0 +1,34 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Intersection_Agg +description: Return the cumulative intersection of all geometries in the input. +kernels: + - returns: geometry + args: [geometry] +--- + +## Examples + +```sql +SELECT ST_Intersection_Agg(geom) FROM ( + VALUES + (ST_GeomFromText('POLYGON ((0 0, 0 4, 4 4, 4 0, 0 0))')), + (ST_GeomFromText('POLYGON ((2 2, 2 6, 6 6, 6 2, 2 2))')) +) AS t(geom); +``` diff --git a/docs/reference/sql/st_intersects.qmd b/docs/reference/sql/st_intersects.qmd index 610730246..6967b9d14 100644 --- a/docs/reference/sql/st_intersects.qmd +++ b/docs/reference/sql/st_intersects.qmd @@ -26,5 +26,8 @@ kernels: ## Examples ```sql -SELECT ST_Intersects(ST_Point(0.25, 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) AS val; +SELECT ST_Intersects( + ST_Point(0.25, 0.25), + ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))') +) AS val; ``` diff --git a/docs/reference/sql/st_isclosed.qmd b/docs/reference/sql/st_isclosed.qmd index ef9d5fa17..b2f1e10bf 100644 --- a/docs/reference/sql/st_isclosed.qmd +++ b/docs/reference/sql/st_isclosed.qmd @@ -23,8 +23,20 @@ kernels: args: [geometry] --- +## Description + +Returns `true` if the LineString's start and end points are the same. For MultiLineStrings, all elements must be closed. + ## Examples ```sql -SELECT ST_IsClosed(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)')); +SELECT ST_IsClosed( + ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0, 0 0)') +); +``` + +```sql +SELECT ST_IsClosed( + ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)') +); ``` diff --git a/docs/reference/sql/st_isempty.qmd b/docs/reference/sql/st_isempty.qmd index 5d4ffd892..e5f4acee2 100644 --- a/docs/reference/sql/st_isempty.qmd +++ b/docs/reference/sql/st_isempty.qmd @@ -28,3 +28,7 @@ kernels: ```sql SELECT ST_IsEmpty(ST_GeomFromWKT('POLYGON EMPTY')); ``` + +```sql +SELECT ST_IsEmpty(ST_Point(1.0, 2.0)); +``` diff --git a/docs/reference/sql/st_isring.qmd b/docs/reference/sql/st_isring.qmd index c6dad361a..1d5efcdc2 100644 --- a/docs/reference/sql/st_isring.qmd +++ b/docs/reference/sql/st_isring.qmd @@ -17,14 +17,20 @@ # under the License. title: ST_IsRing -description: Return true if LINESTRING is ST_IsClosed and ST_IsSimple. +description: Return true if a linestring is ST_IsClosed and ST_IsSimple. kernels: - returns: boolean args: [geometry] --- +## Description + +Returns `true` if the linestring is both closed (`ST_IsClosed`) and simple (`ST_IsSimple`). In other words, the input forms a ring with no self-intersections. + ## Examples ```sql -SELECT ST_IsRing(ST_GeomFromText('LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)')); +SELECT ST_IsRing( + ST_GeomFromText('LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)') +); ``` diff --git a/docs/reference/sql/st_issimple.qmd b/docs/reference/sql/st_issimple.qmd index e4a21badd..5afb95696 100644 --- a/docs/reference/sql/st_issimple.qmd +++ b/docs/reference/sql/st_issimple.qmd @@ -23,8 +23,15 @@ kernels: args: [geometry] --- +## Description + +Returns `true` if the geometry has no anomalous geometric points such as +self-intersections or self-tangency. + ## Examples ```sql -SELECT ST_IsSimple(ST_GeomFromWKT('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))')); +SELECT ST_IsSimple( + ST_GeomFromWKT('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))') +); ``` diff --git a/docs/reference/sql/st_isvalid.qmd b/docs/reference/sql/st_isvalid.qmd index 57d4f7f92..bdf998b8c 100644 --- a/docs/reference/sql/st_isvalid.qmd +++ b/docs/reference/sql/st_isvalid.qmd @@ -23,6 +23,12 @@ kernels: args: [geometry] --- +## Description + +Returns `true` if the geometry is well-formed according to OGC rules. Use +`ST_IsValidReason` to get a diagnostic message for invalid geometries and +`ST_MakeValid` to attempt to repair them. + ## Examples ```sql diff --git a/docs/reference/sql/st_isvalidreason.qmd b/docs/reference/sql/st_isvalidreason.qmd index 3da011c4f..a280d74d8 100644 --- a/docs/reference/sql/st_isvalidreason.qmd +++ b/docs/reference/sql/st_isvalidreason.qmd @@ -23,6 +23,10 @@ kernels: args: [geometry] --- +## Description + +Returns a text string explaining why a geometry is invalid, or `"Valid Geometry"` if the geometry is valid. Useful for debugging geometry construction. + ## Examples ```sql diff --git a/docs/reference/sql/st_knn.qmd b/docs/reference/sql/st_knn.qmd index aef444aac..a899420bc 100644 --- a/docs/reference/sql/st_knn.qmd +++ b/docs/reference/sql/st_knn.qmd @@ -21,14 +21,24 @@ description: Return true if geomA finds k nearest neighbors from geomB. kernels: - returns: boolean args: - - geometry - - geometry + - name: geomA + type: geometry + description: The geometry around which to search. + - name: geomb + type: geometry + description: Column containing candidate geometries. - name: k type: integer + description: The number of nearest neighbours to return. - name: use_spheroid type: boolean + description: true to use spherical distance, false for Euclidean --- +## Description + +`ST_KNN` is used in a join condition to find the k nearest neighbors of one geometry from another set of geometries. The actual k-nearest neighbors logic is handled by the spatial join execution engine: the function itself is a stub that simply defines the expected signature. + ## Examples ```sql diff --git a/docs/reference/sql/st_line_merge.qmd b/docs/reference/sql/st_line_merge.qmd new file mode 100644 index 000000000..9d2ead339 --- /dev/null +++ b/docs/reference/sql/st_line_merge.qmd @@ -0,0 +1,32 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_LineMerge +description: Merges a collection of potentially connected line segments into the fewest possible LineStrings. +kernels: + - returns: geometry + args: [geometry] +--- + +## Examples + +```sql +SELECT ST_LineMerge( + ST_GeomFromWKT('MULTILINESTRING ((0 0, 1 0), (1 0, 1 1))') +); +``` diff --git a/docs/reference/sql/st_m.qmd b/docs/reference/sql/st_m.qmd index 64ae0e6e3..1b5eaa0d4 100644 --- a/docs/reference/sql/st_m.qmd +++ b/docs/reference/sql/st_m.qmd @@ -23,8 +23,17 @@ kernels: args: [geometry] --- +## Description + +Extracts the M (measure) coordinate from a Point geometry or geography. Returns +NULL if the geometry has no M dimension or for non-point geometries. + ## Examples +```sql +SELECT ST_M(ST_PointM(1.0, 2.0, 42.0)); +``` + ```sql SELECT ST_M(ST_Point(1.0, 2.0)); ``` diff --git a/docs/reference/sql/st_maxdistance.qmd b/docs/reference/sql/st_maxdistance.qmd index 072e9ed0c..996a2ee2f 100644 --- a/docs/reference/sql/st_maxdistance.qmd +++ b/docs/reference/sql/st_maxdistance.qmd @@ -17,7 +17,7 @@ # under the License. title: ST_MaxDistance -description: Calculates the maximum distance between two geometries. +description: Returns the maximum distance between any pair of points in two geometries. kernels: - returns: double args: [geometry, geometry] diff --git a/docs/reference/sql/st_npoints.qmd b/docs/reference/sql/st_npoints.qmd index 62bf2164f..ca690d4d4 100644 --- a/docs/reference/sql/st_npoints.qmd +++ b/docs/reference/sql/st_npoints.qmd @@ -23,8 +23,14 @@ kernels: args: [geometry] --- +## Description + +Returns the total number of coordinate points in the geometry, counting all vertices across all components. + ## Examples ```sql -SELECT ST_NPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)')); +SELECT ST_NPoints( + ST_GeomFromText('LINESTRING (1 2, 3 4, 5 6)') +); ``` diff --git a/docs/reference/sql/st_overlaps.qmd b/docs/reference/sql/st_overlaps.qmd index fbbefcd71..848898ef5 100644 --- a/docs/reference/sql/st_overlaps.qmd +++ b/docs/reference/sql/st_overlaps.qmd @@ -23,8 +23,15 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if the two geometries share space and have the same dimension, but are not completely contained by each other. + ## Examples ```sql -SELECT ST_Overlaps(ST_GeomFromWKT('POLYGON((2.5 2.5, 2.5 4.5, 4.5 4.5, 4.5 2.5, 2.5 2.5))'), ST_GeomFromWKT('POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))')); +SELECT ST_Overlaps( + ST_GeomFromWKT('POLYGON((2.5 2.5, 2.5 4.5, 4.5 4.5, 4.5 2.5, 2.5 2.5))'), + ST_GeomFromWKT('POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))') +); ``` diff --git a/docs/reference/sql/st_point.qmd b/docs/reference/sql/st_point.qmd index 5d9545058..045d284f6 100644 --- a/docs/reference/sql/st_point.qmd +++ b/docs/reference/sql/st_point.qmd @@ -25,10 +25,28 @@ kernels: type: double - name: y type: double + - name: srid + type: crs --- +## Description + +Constructs a Point geometry from X and Y coordinates. An optional SRID or CRS can be provided as a third argument. + ## Examples ```sql SELECT ST_AsText(ST_Point(-74.0060, 40.7128)); ``` + +With an SRID: + +```sql +SELECT ST_Point(-74.0060, 40.7128, 4326); +``` + +With a CRS: + +```sql +SELECT ST_Point(-74.0060, 40.7128, 'EPSG:3857'); +``` diff --git a/docs/reference/sql/st_reverse.qmd b/docs/reference/sql/st_reverse.qmd index d4cb48a0a..173e86853 100644 --- a/docs/reference/sql/st_reverse.qmd +++ b/docs/reference/sql/st_reverse.qmd @@ -26,5 +26,5 @@ kernels: ## Examples ```sql -SELECT ST_AsText(ST_Reverse(ST_GeomFromText('LINESTRING(0 0, 1 2, 2 4, 3 6)'))); +SELECT ST_Reverse(ST_GeomFromText('LINESTRING(0 0, 1 2, 2 4, 3 6)')); ``` diff --git a/docs/reference/sql/st_rotate.qmd b/docs/reference/sql/st_rotate.qmd new file mode 100644 index 000000000..059b1eba8 --- /dev/null +++ b/docs/reference/sql/st_rotate.qmd @@ -0,0 +1,33 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Rotate +description: Rotate a geometry counter-clockwise around the Z axis by an angle in radians. +kernels: + - returns: geometry + args: + - geometry + - name: rot + type: double +--- + +## Examples + +```sql +SELECT ST_Rotate(ST_GeomFromText('POINT (1 0)'), radians(90)); +``` diff --git a/docs/reference/sql/st_rotatex.qmd b/docs/reference/sql/st_rotatex.qmd new file mode 100644 index 000000000..ef273ca58 --- /dev/null +++ b/docs/reference/sql/st_rotatex.qmd @@ -0,0 +1,33 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_RotateX +description: Rotate a geometry around the X axis by an angle in radians. +kernels: + - returns: geometry + args: + - geometry + - name: rot + type: double +--- + +## Examples + +```sql +SELECT ST_RotateX(ST_GeomFromText('POINT Z (1 0 0)'), radians(90)); +``` diff --git a/docs/reference/sql/st_rotatey.qmd b/docs/reference/sql/st_rotatey.qmd new file mode 100644 index 000000000..9790c952e --- /dev/null +++ b/docs/reference/sql/st_rotatey.qmd @@ -0,0 +1,33 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_RotateY +description: Rotate a geometry around the Y axis by an angle in radians. +kernels: + - returns: geometry + args: + - geometry + - name: rot + type: double +--- + +## Examples + +```sql +SELECT ST_RotateY(ST_GeomFromText('POINT Z (1 0 0)'), radians(90)); +``` diff --git a/docs/reference/sql/st_scale.qmd b/docs/reference/sql/st_scale.qmd new file mode 100644 index 000000000..dc630be8b --- /dev/null +++ b/docs/reference/sql/st_scale.qmd @@ -0,0 +1,48 @@ +--- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +title: ST_Scale +description: Scale a geometry by multiplying ordinates with scale factors. +kernels: + - returns: geometry + args: + - geometry + - name: scaleX + type: double + - name: scaleY + type: double + - returns: geometry + args: + - geometry + - name: scaleX + type: double + - name: scaleY + type: double + - name: scaleZ + type: double +--- + +## Description + +Scales a geometry by multiplying each coordinate by the corresponding scale factor. A 3D variant accepts `scaleZ`. + +## Examples + +```sql +SELECT ST_Scale(ST_GeomFromText('POINT (1 2)'), 2.0, 3.0); +``` diff --git a/docs/reference/sql/st_simplify.qmd b/docs/reference/sql/st_simplify.qmd index 0063c17b5..44444ae8b 100644 --- a/docs/reference/sql/st_simplify.qmd +++ b/docs/reference/sql/st_simplify.qmd @@ -26,8 +26,17 @@ kernels: type: double --- +## Description + +Simplifies a geometry using the Douglas-Peucker algorithm. The `tolerance` parameter controls the degree of simplification: higher values produce simpler geometries. This function may produce invalid geometries; use `ST_SimplifyPreserveTopology` when validity must be maintained. + ## Examples ```sql -SELECT ST_Simplify(ST_GeomFromWKT('POLYGON((8 25, 28 22, 28 20, 15 11, 33 3, 56 30, 46 33,46 34, 47 44, 35 36, 45 33, 43 19, 29 21, 29 22,35 26, 24 39, 8 25))'), 10); +SELECT ST_Simplify( + ST_GeomFromWKT('POLYGON((8 25, 28 22, 28 20, 15 11, 33 3, 56 30, 46 33, + 46 34, 47 44, 35 36, 45 33, 43 19, 29 21, 29 22, + 35 26, 24 39, 8 25))'), + 10 +); ``` diff --git a/docs/reference/sql/st_startpoint.qmd b/docs/reference/sql/st_startpoint.qmd index f5e8fe663..e4d5bef9f 100644 --- a/docs/reference/sql/st_startpoint.qmd +++ b/docs/reference/sql/st_startpoint.qmd @@ -26,5 +26,7 @@ kernels: ## Examples ```sql -SELECT ST_StartPoint(ST_GeomFromText('LINESTRING(100 150, 50 60, 70 80, 160 170)')); +SELECT ST_StartPoint( + ST_GeomFromText('LINESTRING(100 150, 50 60, 70 80, 160 170)') +); ``` diff --git a/docs/reference/sql/st_symdifference.qmd b/docs/reference/sql/st_symdifference.qmd index 8ce51d6d3..fb6cd61f7 100644 --- a/docs/reference/sql/st_symdifference.qmd +++ b/docs/reference/sql/st_symdifference.qmd @@ -26,5 +26,8 @@ kernels: ## Examples ```sql -SELECT ST_SymDifference(ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_GeomFromWKT('POLYGON((1 0, 3 0, 3 2, 1 2, 1 0))')); +SELECT ST_SymDifference( + ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), + ST_GeomFromWKT('POLYGON((1 0, 3 0, 3 2, 1 2, 1 0))') +); ``` diff --git a/docs/reference/sql/st_touches.qmd b/docs/reference/sql/st_touches.qmd index 9e39e61ad..e63510822 100644 --- a/docs/reference/sql/st_touches.qmd +++ b/docs/reference/sql/st_touches.qmd @@ -23,8 +23,15 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if the two geometries have at least one boundary point in common but no interior points in common. + ## Examples ```sql -SELECT ST_Touches(ST_GeomFromText('POINT(1 2)'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); +SELECT ST_Touches( + ST_GeomFromText('POINT(1 2)'), + ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))') +); ``` diff --git a/docs/reference/sql/st_translate.qmd b/docs/reference/sql/st_translate.qmd index 32fae1b8c..287f94d5f 100644 --- a/docs/reference/sql/st_translate.qmd +++ b/docs/reference/sql/st_translate.qmd @@ -37,6 +37,10 @@ kernels: type: double --- +## Description + +Translates (shifts) a geometry by the given deltaX and deltaY offsets. A 3D variant accepts `deltaZ`. + ## Examples ```sql diff --git a/docs/reference/sql/st_union.qmd b/docs/reference/sql/st_union.qmd index c10518d78..866a66a12 100644 --- a/docs/reference/sql/st_union.qmd +++ b/docs/reference/sql/st_union.qmd @@ -26,5 +26,8 @@ kernels: ## Examples ```sql -SELECT ST_Union(ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_GeomFromWKT('POLYGON((1 0, 3 0, 3 2, 1 2, 1 0))')); +SELECT ST_Union( + ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), + ST_GeomFromWKT('POLYGON((1 0, 3 0, 3 2, 1 2, 1 0))') +); ``` diff --git a/docs/reference/sql/st_union_agg.qmd b/docs/reference/sql/st_union_agg.qmd index 03aa9d546..dda17c1ae 100644 --- a/docs/reference/sql/st_union_agg.qmd +++ b/docs/reference/sql/st_union_agg.qmd @@ -30,5 +30,5 @@ SELECT ST_Union_Agg(geom) FROM ( VALUES (ST_GeomFromText('POLYGON ((0 0, 0 2, 2 2, 2 0, 0 0))')), (ST_GeomFromText('POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1))')) -) AS t(geom) +) AS t(geom); ``` diff --git a/docs/reference/sql/st_within.qmd b/docs/reference/sql/st_within.qmd index be5ea06a8..da70f2a1e 100644 --- a/docs/reference/sql/st_within.qmd +++ b/docs/reference/sql/st_within.qmd @@ -23,8 +23,16 @@ kernels: args: [geometry, geometry] --- +## Description + +Returns `true` if geometry A is completely inside geometry B. This is the inverse +of `ST_Contains`: `ST_Within(A, B)` is equivalent to `ST_Contains(B, A)`. + ## Examples ```sql -SELECT ST_Within(ST_GeomFromWKT('POINT(1 1)'), ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')); +SELECT ST_Within( + ST_GeomFromWKT('POINT(1 1)'), + ST_GeomFromWKT('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))') +); ``` diff --git a/docs/reference/sql/st_x.qmd b/docs/reference/sql/st_x.qmd index 864cba5ac..71bb500b1 100644 --- a/docs/reference/sql/st_x.qmd +++ b/docs/reference/sql/st_x.qmd @@ -23,8 +23,13 @@ kernels: args: [geometry] --- +## Description + +Returns NULL for non-point geometries or NULL input. + ## Examples ```sql SELECT ST_X(ST_Point(-74.0060, 40.7128)); +-- Returns: -74.006 ``` diff --git a/docs/reference/sql/st_y.qmd b/docs/reference/sql/st_y.qmd index d2855e363..59df3f8cf 100644 --- a/docs/reference/sql/st_y.qmd +++ b/docs/reference/sql/st_y.qmd @@ -23,6 +23,10 @@ kernels: args: [geometry] --- +## Description + +Returns NULL for non-point geometries or NULL input. + ## Examples ```sql diff --git a/docs/reference/sql/st_z.qmd b/docs/reference/sql/st_z.qmd index 6531e6e9f..6565df755 100644 --- a/docs/reference/sql/st_z.qmd +++ b/docs/reference/sql/st_z.qmd @@ -23,6 +23,10 @@ kernels: args: [geometry] --- +## Description + +Returns NULL if the geometry has no Z dimension or for non-point geometries. + ## Examples ```sql diff --git a/rust/sedona-functions/src/barrier.rs b/rust/sedona-functions/src/barrier.rs index 6cd7e9bde..94f1f7e40 100644 --- a/rust/sedona-functions/src/barrier.rs +++ b/rust/sedona-functions/src/barrier.rs @@ -19,9 +19,7 @@ use std::{collections::HashMap, sync::Arc}; use arrow_array::builder::BooleanBuilder; use arrow_schema::DataType; use datafusion_common::{exec_err, Result, ScalarValue}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::datatypes::SedonaType; @@ -33,45 +31,10 @@ pub fn barrier_udf() -> SedonaScalarUDF { "barrier", vec![Arc::new(Barrier)], Volatility::Volatile, // Mark as volatile to prevent optimization - Some(barrier_doc()), + None, ) } -fn barrier_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Creates an optimization barrier to prevent filter pushdown by evaluating boolean expressions at runtime", - "barrier(expression: string, col_name1: string, col_value1: any, ...)", - ) - .with_argument("expression", "string: Boolean expression to evaluate at runtime") - .with_argument("col_name", "string: Column name referenced in the expression") - .with_argument("col_value", "any: Actual column value to substitute for col_name") - .with_sql_example(r#"-- Without barrier: optimizer may push down or reorder predicates -SELECT * FROM orders WHERE amount > 100 AND status = 'active'; - --- With barrier: forces the predicate to be evaluated exactly where specified --- The barrier function dynamically evaluates 'amount > 100 AND status = "active"' --- by substituting the actual column values at runtime -SELECT * FROM orders -WHERE barrier('amount > 100 AND status = "active"', - 'amount', amount, -- substitutes 'amount' with actual amount value - 'status', status); -- substitutes 'status' with actual status value - --- Useful for controlling evaluation order in complex queries: --- Without barrier: optimizer might evaluate predicates in any order -SELECT * FROM customers c -JOIN orders o ON c.id = o.customer_id -WHERE c.region = 'US' AND o.total > 1000; - --- With barrier: ensures the join predicate is evaluated after the join -SELECT * FROM customers c -JOIN orders o ON c.id = o.customer_id -WHERE barrier('c_region = "US" AND o_total > 1000', - 'c_region', c.region, - 'o_total', o.total);"#) - .build() -} - #[derive(Debug)] struct Barrier; @@ -393,7 +356,6 @@ mod tests { fn test_barrier_basic() { let udf: ScalarUDF = barrier_udf().into(); assert_eq!(udf.name(), "barrier"); - assert!(udf.documentation().is_some()); } /// Type alias for test case tuple to reduce complexity diff --git a/rust/sedona-functions/src/distance.rs b/rust/sedona-functions/src/distance.rs index 865d840c2..78a0031a5 100644 --- a/rust/sedona-functions/src/distance.rs +++ b/rust/sedona-functions/src/distance.rs @@ -15,41 +15,41 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; /// ST_Distance() scalar UDF stub pub fn st_distance_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_Distance", "Distance") + distance_stub_udf("ST_Distance") } /// ST_DistanceSphere() scalar UDF stub pub fn st_distance_sphere_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_DistanceSphere", "Spherical distance") + distance_stub_udf("ST_DistanceSphere") } /// ST_DistanceSpheroid() scalar UDF stub pub fn st_distance_spheroid_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_DistanceSpheroid", "Spheroidal (ellipsoidal) distance") + distance_stub_udf("ST_DistanceSpheroid") } /// ST_MaxDistance() scalar UDF stub pub fn st_max_distance_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_MaxDistance", "Maximum distance") + distance_stub_udf("ST_MaxDistance") } /// ST_HausdorffDistance() scalar UDF stub pub fn st_hausdorff_distance_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_HausdorffDistance", "Hausdorff distance") + distance_stub_udf("ST_HausdorffDistance") } /// ST_FrechetDistance() scalar UDF stub pub fn st_frechet_distance_udf() -> SedonaScalarUDF { - distance_stub_udf("ST_FrechetDistance", "Frechet distance") + distance_stub_udf("ST_FrechetDistance") } -pub fn distance_stub_udf(name: &str, label: &str) -> SedonaScalarUDF { +pub fn distance_stub_udf(name: &str) -> SedonaScalarUDF { SedonaScalarUDF::new_stub( &name.to_lowercase(), ArgMatcher::new( @@ -60,22 +60,10 @@ pub fn distance_stub_udf(name: &str, label: &str) -> SedonaScalarUDF { SedonaType::Arrow(DataType::Float64), ), Volatility::Immutable, - Some(distance_doc(name, label)), + None, ) } -fn distance_doc(name: &str, label: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("{label} between geomA and geomB"), - format!("{name} (A: Geometry, B: Geometry)") - ) - .with_argument("geomA", "geometry: Input geometry or geography") - .with_argument("geomB", "geometry: Input geometry or geography") - .with_sql_example(format!("SELECT {name}(ST_GeomFromText('POLYGON ((10 10, 11 10, 10 11, 10 10))'), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) AS val")) - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -86,6 +74,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_distance_udf().into(); assert_eq!(udf.name(), "st_distance"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/overlay.rs b/rust/sedona-functions/src/overlay.rs index c2a46615e..6cb30e22b 100644 --- a/rust/sedona-functions/src/overlay.rs +++ b/rust/sedona-functions/src/overlay.rs @@ -14,31 +14,31 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; /// ST_Intersection() scalar UDF stub pub fn st_intersection_udf() -> SedonaScalarUDF { - overlay_stub_udf("ST_Intersection", "Intersection") + overlay_stub_udf("ST_Intersection") } /// ST_Union() scalar UDF stub pub fn st_union_udf() -> SedonaScalarUDF { - overlay_stub_udf("ST_Union", "Union") + overlay_stub_udf("ST_Union") } /// ST_Difference() scalar UDF stub pub fn st_difference_udf() -> SedonaScalarUDF { - overlay_stub_udf("ST_Difference", "Difference") + overlay_stub_udf("ST_Difference") } /// ST_SymDifference() scalar UDF stub pub fn st_sym_difference_udf() -> SedonaScalarUDF { - overlay_stub_udf("ST_SymDifference", "Symmetric difference") + overlay_stub_udf("ST_SymDifference") } -pub fn overlay_stub_udf(name: &str, action: &str) -> SedonaScalarUDF { +pub fn overlay_stub_udf(name: &str) -> SedonaScalarUDF { SedonaScalarUDF::new_stub( &name.to_lowercase(), ArgMatcher::new( @@ -49,22 +49,10 @@ pub fn overlay_stub_udf(name: &str, action: &str) -> SedonaScalarUDF { WKB_GEOMETRY, ), Volatility::Immutable, - Some(overlay_doc(name, action)), + None, ) } -fn overlay_doc(name: &str, action: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("{action} between geomA and geomB"), - format!("{name} (A: Geometry, B: Geometry)") - ) - .with_argument("geomA", "geometry: Input geometry or geography") - .with_argument("geomB", "geometry: Input geometry or geography") - .with_sql_example(format!("SELECT {name}(ST_GeomFromText('POLYGON ((1 1, 11 1, 1 11, 0 0))'), ST_GeomFromText('POLYGON ((0 0, 10 0, 0 10, 0 0))')) AS val")) - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -75,6 +63,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_intersection_udf().into(); assert_eq!(udf.name(), "st_intersection"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/predicates.rs b/rust/sedona-functions/src/predicates.rs index d914b992f..2c7431455 100644 --- a/rust/sedona-functions/src/predicates.rs +++ b/rust/sedona-functions/src/predicates.rs @@ -15,48 +15,48 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; /// ST_Equals() scalar UDF stub pub fn st_equals_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Equals", "equals") + predicate_stub_udf("ST_Equals") } /// ST_Intersects() scalar UDF stub pub fn st_intersects_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Intersects", "intersects") + predicate_stub_udf("ST_Intersects") } /// ST_Disjoint() scalar UDF stub pub fn st_disjoint_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Disjoint", "is disjoint from") + predicate_stub_udf("ST_Disjoint") } /// ST_Contains() scalar UDF stub pub fn st_contains_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Contains", "contains") + predicate_stub_udf("ST_Contains") } /// ST_Within() scalar UDF stub pub fn st_within_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Within", "is fully contained by") + predicate_stub_udf("ST_Within") } /// ST_Covers() scalar UDF stub pub fn st_covers_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Covers", "covers") + predicate_stub_udf("ST_Covers") } /// ST_CoveredBy() scalar UDF stub pub fn st_covered_by_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_CoveredBy", "is covered by") + predicate_stub_udf("ST_CoveredBy") } /// ST_Touches() scalar UDF stub pub fn st_touches_udf() -> SedonaScalarUDF { - predicate_stub_udf("ST_Touches", "touches") + predicate_stub_udf("ST_Touches") } /// ST_KNN() scalar UDF stub @@ -77,11 +77,11 @@ pub fn st_knn_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Boolean), ), Volatility::Immutable, - Some(knn_doc("ST_KNN", "finds k nearest neighbors")), + None, ) } -pub fn predicate_stub_udf(name: &str, action: &str) -> SedonaScalarUDF { +pub fn predicate_stub_udf(name: &str) -> SedonaScalarUDF { SedonaScalarUDF::new_stub( &name.to_lowercase(), ArgMatcher::new( @@ -92,38 +92,10 @@ pub fn predicate_stub_udf(name: &str, action: &str) -> SedonaScalarUDF { SedonaType::Arrow(DataType::Boolean), ), Volatility::Immutable, - Some(predicate_doc(name, action)), + None, ) } -fn predicate_doc(name: &str, action: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("Return true if geomA {action} geomB"), - format!("{name} (A: Geometry, B: Geometry)") - ) - .with_argument("geomA", "geometry: Input geometry or geography") - .with_argument("geomB", "geometry: Input geometry or geography") - .with_sql_example(format!("SELECT {name}(ST_Point(0.25 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))')) AS val")) - .build() -} - -fn knn_doc(name: &str, action: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("Return true if geomA {action} from geomB"), - format!("{name} (A: Geometry, B: Geometry, k: Integer, use_spheroid: Boolean)"), - ) - .with_argument("geomA", "geometry: Query geometry or geography") - .with_argument("geomB", "geometry: Object geometry or geography") - .with_argument("k", "integer: Number of nearest neighbors to find") - .with_argument("use_spheroid", "boolean: Use spheroid distance calculation") - .with_sql_example(format!( - "SELECT * FROM table1 a JOIN table2 b ON {name}(a.geom, b.geom, 5, false)" - )) - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -134,6 +106,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_intersects_udf().into(); assert_eq!(udf.name(), "st_intersects"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/referencing.rs b/rust/sedona-functions/src/referencing.rs index bc8ba969f..1d2358ff6 100644 --- a/rust/sedona-functions/src/referencing.rs +++ b/rust/sedona-functions/src/referencing.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{ datatypes::{SedonaType, WKB_GEOMETRY}, @@ -31,24 +31,10 @@ pub fn st_line_locate_point_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Float64), ), Volatility::Immutable, - Some(st_line_locate_point_doc()), + None, ) } -fn st_line_locate_point_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the distance along a linear geometry required to reach the closest point to target", - "ST_LineLocatePoint (geom: Geometry, target: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("target", "geometry: Point to locate") - .with_sql_example( - "SELECT ST_LineLocatePoint(ST_GeomFromWKT('LINESTRING(38 16, 38 50, 65 50, 66 16, 38 16)'), ST_Point(38, 50))", - ) - .build() -} - /// ST_LineInterpolatePoint() scalar UDF implementation pub fn st_line_interpolate_point_udf() -> SedonaScalarUDF { SedonaScalarUDF::new_stub( @@ -58,22 +44,8 @@ pub fn st_line_interpolate_point_udf() -> SedonaScalarUDF { WKB_GEOMETRY, ), Volatility::Immutable, - Some(st_line_interpolate_point_doc()), - ) -} - -fn st_line_interpolate_point_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the point at a given relative distance (0 to 1) along a linear geometry", - "ST_LineInterpolatePoint (geom: Geometry, distance: double)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("distance", "double: Relative distance along geom") - .with_sql_example( - "SELECT ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING(38 16, 38 50, 65 50, 66 16, 38 16)'), 0.25)", + None, ) - .build() } #[cfg(test)] @@ -86,10 +58,8 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_line_interpolate_point_udf().into(); assert_eq!(udf.name(), "st_lineinterpolatepoint"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_line_locate_point_udf().into(); assert_eq!(udf.name(), "st_linelocatepoint"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/sd_format.rs b/rust/sedona-functions/src/sd_format.rs index 31d11b50d..8152372b1 100644 --- a/rust/sedona-functions/src/sd_format.rs +++ b/rust/sedona-functions/src/sd_format.rs @@ -26,9 +26,7 @@ use datafusion_common::{ error::{DataFusionError, Result}, internal_err, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -42,30 +40,8 @@ pub fn sd_format_udf() -> SedonaScalarUDF { "sd_format", vec![Arc::new(SDFormatDefault {})], Volatility::Immutable, - Some(sd_format_doc()), - ) -} - -fn sd_format_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return a version of value suitable for formatting/display with - the options provided. This is used to inject custom behaviour for a - SedonaType specifically for formatting values.", - "SD_Format (value: Any, [options: String])", - ) - .with_argument("value", "Any: Any input value") - .with_argument( - "options", - " - String: JSON-encoded options. The following options are currently supported: - - - width_hint (numeric): The approximate width of the output. The value provided will - typically be an overestimate and the value may be further abrevidated by - the renderer. This value is purely a hint and may be ignored.", + None, ) - .with_sql_example("SELECT SD_Format(ST_Point(1.0, 2.0, '{}'))") - .build() } /// Default implementation that returns its input (i.e., by default, just @@ -406,7 +382,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = sd_format_udf().into(); assert_eq!(udf.name(), "sd_format"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/sd_order.rs b/rust/sedona-functions/src/sd_order.rs index 8419b57a2..2cdcd22d9 100644 --- a/rust/sedona-functions/src/sd_order.rs +++ b/rust/sedona-functions/src/sd_order.rs @@ -16,9 +16,7 @@ // under the License. use datafusion_common::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::datatypes::SedonaType; use std::{fmt::Debug, sync::Arc}; @@ -35,21 +33,10 @@ pub fn sd_order_udf() -> SedonaScalarUDF { "sd_order", vec![Arc::new(SDOrderDefault {})], Volatility::Immutable, - Some(sd_order_doc()), + None, ) } -fn sd_order_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return an arbitrary value that may be used to sort the input.", - "SD_Order (value: Any)", - ) - .with_argument("value", "Any: An arbitrary value") - .with_sql_example("SELECT SD_Order()") - .build() -} - /// Default implementation that returns its input (i.e., by default, just /// do whatever DataFusion would have done with the value) #[derive(Debug)] @@ -88,7 +75,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = sd_order_udf().into(); assert_eq!(udf.name(), "sd_order"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_affine.rs b/rust/sedona-functions/src/st_affine.rs index c831b710f..5bf9d9e98 100644 --- a/rust/sedona-functions/src/st_affine.rs +++ b/rust/sedona-functions/src/st_affine.rs @@ -17,9 +17,7 @@ use arrow_array::{builder::BinaryBuilder, Array}; use arrow_schema::DataType; use datafusion_common::{error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -47,31 +45,8 @@ pub fn st_affine_udf() -> SedonaScalarUDF { Arc::new(STAffine { is_3d: false }), ]), Volatility::Immutable, - Some(st_affine_doc()), - ) -} - -fn st_affine_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Apply an affine transformation to the given geometry.", - "ST_Affine (geom: Geometry, a: Double, b: Double, c: Double, d: Double, e: Double, f: Double, g: Double, h: Double, i: Double, xOff: Double, yOff: Double, zOff: Double)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("a", "a component of the affine matrix") - .with_argument("b", "a component of the affine matrix") - .with_argument("c", "a component of the affine matrix") - .with_argument("d", "a component of the affine matrix") - .with_argument("e", "a component of the affine matrix") - .with_argument("f", "a component of the affine matrix") - .with_argument("g", "a component of the affine matrix") - .with_argument("h", "a component of the affine matrix") - .with_argument("i", "a component of the affine matrix") - .with_argument("xOff", "X offset") - .with_argument("yOff", "Y offset") - .with_argument("zOff", "Z offset") - .with_sql_example("SELECT ST_Affine(ST_GeomFromText('POLYGON Z ((1 0 1, 1 1 1, 2 2 2, 1 0 1))'), 1, 2, 4, 1, 1, 2, 3, 2, 5, 4, 8, 3)") - .build() } #[derive(Debug)] @@ -174,7 +149,7 @@ mod tests { fn udf_metadata() { let st_affine_udf: ScalarUDF = st_affine_udf().into(); assert_eq!(st_affine_udf.name(), "st_affine"); - assert!(st_affine_udf.documentation().is_some()); + assert!(st_affine_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_analyze_agg.rs b/rust/sedona-functions/src/st_analyze_agg.rs index 5377255a2..a5d609218 100644 --- a/rust/sedona-functions/src/st_analyze_agg.rs +++ b/rust/sedona-functions/src/st_analyze_agg.rs @@ -28,7 +28,7 @@ use datafusion_common::{ error::{DataFusionError, Result}, ScalarValue, }; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use datafusion_expr::{Accumulator, ColumnarValue}; use sedona_common::{sedona_internal_datafusion_err, sedona_internal_err}; use sedona_expr::aggregate_udf::SedonaAccumulatorRef; @@ -53,21 +53,9 @@ pub fn st_analyze_agg_udf() -> SedonaAggregateUDF { "st_analyze_agg", ItemCrsSedonaAccumulator::wrap_impl(STAnalyzeAgg {}), Volatility::Immutable, - Some(st_analyze_agg_doc()), + None, ) } - -fn st_analyze_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the statistics of geometries for geom.", - "ST_Analyze_Agg (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example(" - SELECT ST_Analyze_Agg(ST_GeomFromText('MULTIPOINT(1.1 101.1,2.1 102.1,3.1 103.1,4.1 104.1,5.1 105.1,6.1 106.1,7.1 107.1,8.1 108.1,9.1 109.1,10.1 110.1)'))") - .build() -} /// ST_Analyze_Agg() implementation pub fn st_analyze_agg_impl() -> SedonaAccumulatorRef { Arc::new(STAnalyzeAgg {}) diff --git a/rust/sedona-functions/src/st_area.rs b/rust/sedona-functions/src/st_area.rs index a451a6477..520d2586c 100644 --- a/rust/sedona-functions/src/st_area.rs +++ b/rust/sedona-functions/src/st_area.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -30,21 +30,10 @@ pub fn st_area_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Float64), ), Volatility::Immutable, - Some(st_area_doc()), + None, ) } -fn st_area_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the area of a geometry", - "ST_Area (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Area(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'))") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -55,6 +44,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_area_udf().into(); assert_eq!(udf.name(), "st_area"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_asbinary.rs b/rust/sedona-functions/src/st_asbinary.rs index 25569c04b..84bcdae50 100644 --- a/rust/sedona-functions/src/st_asbinary.rs +++ b/rust/sedona-functions/src/st_asbinary.rs @@ -18,9 +18,7 @@ use std::{sync::Arc, vec}; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -35,22 +33,11 @@ pub fn st_asbinary_udf() -> SedonaScalarUDF { "st_asbinary", ItemCrsKernel::wrap_impl(vec![Arc::new(STAsBinary {})]), Volatility::Immutable, - Some(st_asbinary_doc()), + None, ); udf.with_aliases(vec!["st_aswkb".to_string()]) } -fn st_asbinary_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the Well-Known Binary representation of a geometry or geography", - "ST_AsBinary (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_AsBinary(ST_Point(1.0, 2.0))") - .build() -} - #[derive(Debug)] struct STAsBinary {} @@ -100,7 +87,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_asbinary_udf().into(); assert_eq!(udf.name(), "st_asbinary"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_asewkb.rs b/rust/sedona-functions/src/st_asewkb.rs index 76cab1623..e7f46d2ed 100644 --- a/rust/sedona-functions/src/st_asewkb.rs +++ b/rust/sedona-functions/src/st_asewkb.rs @@ -23,9 +23,7 @@ use datafusion_common::{ error::Result, exec_datafusion_err, exec_err, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_geometry::{ewkb_factory::write_ewkb_geometry, wkb_factory::WKB_MIN_PROBABLE_BYTES}; @@ -41,23 +39,8 @@ pub fn st_asewkb_udf() -> SedonaScalarUDF { "st_asewkb", vec![Arc::new(STAsEWKBItemCrs {}), Arc::new(STAsEWKB {})], Volatility::Immutable, - Some(st_asewkb_doc()), - ) -} - -fn st_asewkb_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - r#"Return the Extended Well-Known Binary (EWKB) representation of a geometry or geography. - -Compared to ST_AsBinary(), this function embeds an integer SRID derived from the type or derived -from the item-level CRS for item CRS types. This is particularly useful for integration with -PostGIS"#, - "ST_AsEWKB (A: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_AsEWKB(ST_Point(1.0, 2.0, 4326))") - .build() } #[derive(Debug)] @@ -222,7 +205,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_asewkb_udf().into(); assert_eq!(udf.name(), "st_asewkb"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_asgeojson.rs b/rust/sedona-functions/src/st_asgeojson.rs index c3d127c35..61b5c93fd 100644 --- a/rust/sedona-functions/src/st_asgeojson.rs +++ b/rust/sedona-functions/src/st_asgeojson.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -30,22 +30,10 @@ pub fn st_asgeojson_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Utf8), ), Volatility::Immutable, - Some(st_asgeojson_doc()), + None, ) } -fn st_asgeojson_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the GeoJSON representation of a geometry", - "ST_AsGeoJSON (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_AsGeoJSON(ST_Point(1.0, 2.0))") - .with_related_udf("ST_GeomFromGeoJSON") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -56,6 +44,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_asgeojson_udf().into(); assert_eq!(udf.name(), "st_asgeojson"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_astext.rs b/rust/sedona-functions/src/st_astext.rs index 26e90c711..5ca343283 100644 --- a/rust/sedona-functions/src/st_astext.rs +++ b/rust/sedona-functions/src/st_astext.rs @@ -20,9 +20,7 @@ use crate::executor::WkbExecutor; use arrow_array::builder::StringBuilder; use arrow_schema::DataType; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -37,23 +35,11 @@ pub fn st_astext_udf() -> SedonaScalarUDF { "st_astext", ItemCrsKernel::wrap_impl(vec![Arc::new(STAsText {})]), Volatility::Immutable, - Some(st_astext_doc()), + None, ); udf.with_aliases(vec!["st_aswkt".to_string()]) } -fn st_astext_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the Well-Known Text string representation of a geometry or geography", - "ST_AsText (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_AsText(ST_Point(1.0, 2.0))") - .with_related_udf("ST_GeomFromWKT") - .build() -} - #[derive(Debug)] struct STAsText {} @@ -122,7 +108,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_astext_udf().into(); assert_eq!(udf.name(), "st_astext"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_azimuth.rs b/rust/sedona-functions/src/st_azimuth.rs index 1123feea0..440fd1139 100644 --- a/rust/sedona-functions/src/st_azimuth.rs +++ b/rust/sedona-functions/src/st_azimuth.rs @@ -17,9 +17,7 @@ use arrow_array::builder::Float64Builder; use arrow_schema::DataType; use datafusion_common::{error::Result, exec_err}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{CoordTrait, GeometryTrait, GeometryType, PointTrait}; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -39,22 +37,8 @@ pub fn st_azimuth_udf() -> SedonaScalarUDF { "st_azimuth", ItemCrsKernel::wrap_impl(vec![Arc::new(STAzimuth {})]), Volatility::Immutable, - Some(st_azimuth_doc()), - ) -} - -fn st_azimuth_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the azimuth (a clockwise angle measured from north) in radians from geomA to geomB", - "ST_Azimuth (A: Geometry, B: Geometry)", - ) - .with_argument("geomA", "geometry: Start point geometry") - .with_argument("geomB", "geometry: End point geometry") - .with_sql_example( - "SELECT degrees(ST_Azimuth(ST_Point(0, 0), ST_Point(1, 1)))", + None, ) - .build() } #[derive(Debug)] @@ -145,7 +129,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_azimuth_udf().into(); assert_eq!(udf.name(), "st_azimuth"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_buffer.rs b/rust/sedona-functions/src/st_buffer.rs index 46dcd003f..853726d6a 100644 --- a/rust/sedona-functions/src/st_buffer.rs +++ b/rust/sedona-functions/src/st_buffer.rs @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -30,22 +30,10 @@ pub fn st_buffer_udf() -> SedonaScalarUDF { WKB_GEOMETRY, ), Volatility::Immutable, - Some(st_buffer_doc()), + None, ) } -fn st_buffer_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns a geometry that represents all points whose distance from this Geometry is less than or equal to distance", - "st_buffer (A: Geometry, B: Double)" - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("distance", "distance: Radius of the buffer") - .with_sql_example("SELECT ST_Buffer(ST_GeomFromText('POLYGON ((10 10, 11 10, 10 11, 10 10))'), 1.0)".to_string()) - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -56,6 +44,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_buffer_udf().into(); assert_eq!(udf.name(), "st_buffer"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_centroid.rs b/rust/sedona-functions/src/st_centroid.rs index f1020352c..11d5c9b60 100644 --- a/rust/sedona-functions/src/st_centroid.rs +++ b/rust/sedona-functions/src/st_centroid.rs @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -26,21 +26,10 @@ pub fn st_centroid_udf() -> SedonaScalarUDF { "st_centroid", ArgMatcher::new(vec![ArgMatcher::is_geometry()], WKB_GEOMETRY), Volatility::Immutable, - Some(st_centroid_doc()), + None, ) } -fn st_centroid_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the centroid of geom", - "ST_Centroid (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Centroid(ST_GeomFromText('POLYGON ((1 1, 11 1, 1 11, 0 0))'))") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -51,6 +40,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_centroid_udf().into(); assert_eq!(udf.name(), "st_centroid"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_collect_agg.rs b/rust/sedona-functions/src/st_collect_agg.rs index 3a801d3e3..5604794b5 100644 --- a/rust/sedona-functions/src/st_collect_agg.rs +++ b/rust/sedona-functions/src/st_collect_agg.rs @@ -24,9 +24,7 @@ use datafusion_common::{ error::{DataFusionError, Result}, exec_err, HashSet, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, Accumulator, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{Accumulator, ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_common::sedona_internal_err; use sedona_expr::{ @@ -58,19 +56,8 @@ pub fn st_collect_agg_udf() -> SedonaAggregateUDF { Arc::new(STCollectAggr { is_geography: true }), ]), Volatility::Immutable, - Some(st_collect_agg_doc()), - ) -} - -fn st_collect_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the entire envelope boundary of all geometries in geom", - "ST_Collect_Agg (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_Collect_Agg(ST_GeomFromWKT('MULTIPOINT (0 1, 10 11)'))") - .build() } #[derive(Debug)] @@ -327,7 +314,6 @@ mod test { fn udf_metadata() { let udf: AggregateUDF = st_collect_agg_udf().into(); assert_eq!(udf.name(), "st_collect_agg"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_concavehull.rs b/rust/sedona-functions/src/st_concavehull.rs index 298e89512..c19495a27 100644 --- a/rust/sedona-functions/src/st_concavehull.rs +++ b/rust/sedona-functions/src/st_concavehull.rs @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -29,22 +29,10 @@ pub fn st_concavehull_udf() -> SedonaScalarUDF { WKB_GEOMETRY, ), Volatility::Immutable, - Some(st_concavehull_doc()), + None, ) } -fn st_concavehull_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the hull enclosing all points of the inputs", - "ST_ConcaveHull (geom: Geometry, pct_convex: Float64)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("pct_convex", "float: Percentage of Convex") - .with_sql_example("SELECT ST_ConcaveHull('LINESTRING(100 150,50 60, 70 80, 160 170)', 0.3);") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -55,6 +43,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_concavehull_udf().into(); assert_eq!(udf.name(), "st_concavehull"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_dimension.rs b/rust/sedona-functions/src/st_dimension.rs index adbad9b7e..72fd87be3 100644 --- a/rust/sedona-functions/src/st_dimension.rs +++ b/rust/sedona-functions/src/st_dimension.rs @@ -20,9 +20,7 @@ use crate::executor::WkbExecutor; use arrow_array::builder::Int8Builder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{GeometryCollectionTrait, GeometryTrait, GeometryType}; use sedona_common::sedona_internal_err; use sedona_expr::{ @@ -37,19 +35,8 @@ pub fn st_dimension_udf() -> SedonaScalarUDF { "st_dimension", ItemCrsKernel::wrap_impl(vec![Arc::new(STDimension {})]), Volatility::Immutable, - Some(st_dimension_doc()), - ) -} - -fn st_dimension_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the dimension of the geometry", - "ST_Dimension (A: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Dimension(ST_GeomFromWKT('POLYGON EMPTY'))") - .build() } #[derive(Debug)] @@ -121,7 +108,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_dimension_udf().into(); assert_eq!(udf.name(), "st_dimension"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_dump.rs b/rust/sedona-functions/src/st_dump.rs index 537211d5a..2a46a152c 100644 --- a/rust/sedona-functions/src/st_dump.rs +++ b/rust/sedona-functions/src/st_dump.rs @@ -20,9 +20,7 @@ use arrow_array::{ }; use arrow_schema::{DataType, Field, Fields}; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{ GeometryCollectionTrait, GeometryTrait, GeometryType, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, @@ -46,19 +44,8 @@ pub fn st_dump_udf() -> SedonaScalarUDF { "st_dump", vec![Arc::new(STDump)], Volatility::Immutable, - Some(st_dump_doc()), - ) -} - -fn st_dump_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Extracts the components of a geometry.", - "ST_Dump (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Dump(ST_GeomFromWKT('MULTIPOINT (0 1, 2 3, 4 5)'))") - .build() } #[derive(Debug)] @@ -272,7 +259,7 @@ mod tests { fn udf_metadata() { let st_dump_udf: ScalarUDF = st_dump_udf().into(); assert_eq!(st_dump_udf.name(), "st_dump"); - assert!(st_dump_udf.documentation().is_some()); + assert!(st_dump_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_dwithin.rs b/rust/sedona-functions/src/st_dwithin.rs index 47e602c8d..320c7dde6 100644 --- a/rust/sedona-functions/src/st_dwithin.rs +++ b/rust/sedona-functions/src/st_dwithin.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -32,23 +32,10 @@ pub fn st_dwithin_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Boolean), ), Volatility::Immutable, - Some(dwithin_doc()), + None, ) } -fn dwithin_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return true if geomA is within distance of geomB", - "ST_DWithin (A: Geometry, B: Geometry, distance: Double)" - ) - .with_argument("geomA", "geometry: Input geometry or geography") - .with_argument("geomB", "geometry: Input geometry or geography") - .with_argument("distance", "double: Distance in units of the geometry's coordinate system") - .with_sql_example("SELECT ST_DWithin(ST_Point(0.25 0.25), ST_GeomFromText('POLYGON ((0 0, 1 0, 0 1, 0 0))'), 0.5)") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -59,6 +46,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_dwithin_udf().into(); assert_eq!(udf.name(), "st_dwithin"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_envelope.rs b/rust/sedona-functions/src/st_envelope.rs index cdf0ccb09..26903eee9 100644 --- a/rust/sedona-functions/src/st_envelope.rs +++ b/rust/sedona-functions/src/st_envelope.rs @@ -19,9 +19,7 @@ use std::{sync::Arc, vec}; use crate::executor::WkbExecutor; use arrow_array::builder::BinaryBuilder; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::GeometryTrait; use sedona_common::sedona_internal_err; use sedona_expr::{ @@ -52,19 +50,8 @@ pub fn st_envelope_udf() -> SedonaScalarUDF { "st_envelope", ItemCrsKernel::wrap_impl(vec![Arc::new(STEnvelope {})]), Volatility::Immutable, - Some(st_envelope_doc()), - ) -} - -fn st_envelope_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the envelope of a geometry", - "ST_Envelope(A: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Envelope(ST_Point(1.0, 2.0))") - .build() } #[derive(Debug)] @@ -193,7 +180,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_envelope_udf().into(); assert_eq!(udf.name(), "st_envelope"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_envelope_agg.rs b/rust/sedona-functions/src/st_envelope_agg.rs index 7966052c4..3ae0d3773 100644 --- a/rust/sedona-functions/src/st_envelope_agg.rs +++ b/rust/sedona-functions/src/st_envelope_agg.rs @@ -24,10 +24,7 @@ use datafusion_common::{ error::{DataFusionError, Result}, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, Accumulator, ColumnarValue, Documentation, EmitTo, - GroupsAccumulator, Volatility, -}; +use datafusion_expr::{Accumulator, ColumnarValue, EmitTo, GroupsAccumulator, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::{ aggregate_udf::{SedonaAccumulator, SedonaAggregateUDF}, @@ -51,19 +48,8 @@ pub fn st_envelope_agg_udf() -> SedonaAggregateUDF { "st_envelope_agg", ItemCrsSedonaAccumulator::wrap_impl(vec![Arc::new(STEnvelopeAgg {})]), Volatility::Immutable, - Some(st_envelope_agg_doc()), - ) -} - -fn st_envelope_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the entire envelope boundary of all geometries in geom", - "ST_Envelope_Agg (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_Envelope_Agg(ST_GeomFromWKT('MULTIPOINT (0 1, 10 11)'))") - .build() } #[derive(Debug)] @@ -361,7 +347,6 @@ mod test { fn udf_metadata() { let udf: AggregateUDF = st_envelope_agg_udf().into(); assert_eq!(udf.name(), "st_envelope_agg"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_flipcoordinates.rs b/rust/sedona-functions/src/st_flipcoordinates.rs index 42e5bcdc1..f296d1747 100644 --- a/rust/sedona-functions/src/st_flipcoordinates.rs +++ b/rust/sedona-functions/src/st_flipcoordinates.rs @@ -19,9 +19,7 @@ use std::{sync::Arc, vec}; use crate::executor::WkbExecutor; use arrow_array::builder::BinaryBuilder; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -47,19 +45,8 @@ pub fn st_flipcoordinates_udf() -> SedonaScalarUDF { "st_flipcoordinates", ItemCrsKernel::wrap_impl(vec![Arc::new(STFlipCoordinates {})]), Volatility::Immutable, - Some(st_flipcoordinates_doc()), - ) -} - -fn st_flipcoordinates_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns a version of the given geometry with X and Y axis flipped.", - "ST_FlipCoordinates(A:geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_FlipCoordinates(df.geometry)") - .build() } #[derive(Debug)] @@ -145,7 +132,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_flipcoordinates_udf().into(); assert_eq!(udf.name(), "st_flipcoordinates"); - assert!(udf.documentation().is_some()); } #[test] diff --git a/rust/sedona-functions/src/st_force_dim.rs b/rust/sedona-functions/src/st_force_dim.rs index 5946c05ca..50d10b25f 100644 --- a/rust/sedona-functions/src/st_force_dim.rs +++ b/rust/sedona-functions/src/st_force_dim.rs @@ -20,9 +20,7 @@ use std::sync::Arc; use arrow_array::{builder::BinaryBuilder, Float64Array}; use arrow_schema::DataType; use datafusion_common::{cast::as_float64_array, error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -83,19 +81,8 @@ pub fn st_force2d_udf() -> SedonaScalarUDF { Arc::new(STForce2D { is_geography: true }), ]), Volatility::Immutable, - Some(st_force2d_doc()), - ) -} - -fn st_force2d_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Forces the geometry into a 2-dimensional model", - "ST_Force2D (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Force2D(ST_GeomFromWKT('POINT Z (1 2 3)'))") - .build() } #[derive(Debug)] @@ -168,20 +155,8 @@ pub fn st_force3d_udf() -> SedonaScalarUDF { Arc::new(STForce3D { is_geography: true }), ]), Volatility::Immutable, - Some(st_force3d_doc()), - ) -} - -fn st_force3d_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Forces the geometry into a 3-dimensional model.", - "ST_Force3D (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("z", "numeric: default Z value") - .with_sql_example("SELECT ST_Force3D(ST_GeomFromWKT('POINT (1 2)'))") - .build() } #[derive(Debug)] @@ -271,22 +246,10 @@ pub fn st_force3dm_udf() -> SedonaScalarUDF { Arc::new(STForce3DM { is_geography: true }), ]), Volatility::Immutable, - Some(st_force3dm_doc()), + None, ) } -fn st_force3dm_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Forces the geometry into a 3DM-dimensional model.", - "ST_Force3DM (geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("m", "numeric: default M value") - .with_sql_example("SELECT ST_Force3DM(ST_GeomFromWKT('POINT (1 2)'))") - .build() -} - #[derive(Debug)] struct STForce3DM { is_geography: bool, @@ -375,21 +338,8 @@ pub fn st_force4d_udf() -> SedonaScalarUDF { Arc::new(STForce4D { is_geography: true }), ]), Volatility::Immutable, - Some(st_force4d_doc()), - ) -} - -fn st_force4d_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Forces the geometry into a 4-dimensional model.", - "ST_Force4D (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("z", "numeric: default Z value") - .with_argument("m", "numeric: default M value") - .with_sql_example("SELECT ST_Force4D(ST_GeomFromWKT('POINT (1 2)'))") - .build() } #[derive(Debug)] @@ -493,19 +443,15 @@ mod tests { fn udf_metadata() { let st_force2d: ScalarUDF = st_force2d_udf().into(); assert_eq!(st_force2d.name(), "st_force2d"); - assert!(st_force2d.documentation().is_some()); let st_force3d: ScalarUDF = st_force3d_udf().into(); assert_eq!(st_force3d.name(), "st_force3d"); - assert!(st_force3d.documentation().is_some()); let st_force3dm: ScalarUDF = st_force3dm_udf().into(); assert_eq!(st_force3dm.name(), "st_force3dm"); - assert!(st_force3dm.documentation().is_some()); let st_force4d: ScalarUDF = st_force4d_udf().into(); assert_eq!(st_force4d.name(), "st_force4d"); - assert!(st_force4d.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_geometryn.rs b/rust/sedona-functions/src/st_geometryn.rs index 5c60f000f..da686da10 100644 --- a/rust/sedona-functions/src/st_geometryn.rs +++ b/rust/sedona-functions/src/st_geometryn.rs @@ -20,10 +20,7 @@ use std::sync::Arc; use crate::executor::WkbExecutor; use arrow_array::builder::BinaryBuilder; use datafusion_common::{cast::as_int64_array, Result}; -use datafusion_expr::scalar_doc_sections::DOC_SECTION_OTHER; -use datafusion_expr::ColumnarValue; -use datafusion_expr::Documentation; -use datafusion_expr::Volatility; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{ GeometryCollectionTrait, GeometryTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, @@ -45,22 +42,10 @@ pub fn st_geometryn_udf() -> SedonaScalarUDF { "st_geometryn", ItemCrsKernel::wrap_impl(vec![Arc::new(STGeometryN)]), Volatility::Immutable, - Some(st_geometryn_doc()), + None, ) } -fn st_geometryn_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the 1-based Nth element geometry of an input geometry which is a GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE, MULTI)POLYGON, or POLYHEDRALSURFACE. Otherwise, returns NULL.", - "ST_GeometryN (geom: Geometry, n: integer)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("n", "n: Index") - .with_sql_example("SELECT ST_GeometryN('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(20 20, 30 30), POLYGON((1 1, 2 2, 1 2, 1 1)))', 1)") - .build() -} - #[derive(Debug)] struct STGeometryN; diff --git a/rust/sedona-functions/src/st_geometrytype.rs b/rust/sedona-functions/src/st_geometrytype.rs index 9f5e2e612..ab114f6de 100644 --- a/rust/sedona-functions/src/st_geometrytype.rs +++ b/rust/sedona-functions/src/st_geometrytype.rs @@ -20,9 +20,7 @@ use crate::executor::WkbBytesExecutor; use arrow_array::builder::StringBuilder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -35,19 +33,8 @@ pub fn st_geometry_type_udf() -> SedonaScalarUDF { "st_geometrytype", ItemCrsKernel::wrap_impl(vec![Arc::new(STGeometryType {})]), Volatility::Immutable, - Some(st_geometry_type_doc()), - ) -} - -fn st_geometry_type_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the type of a geometry", - "ST_GeometryType (A: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_GeometryType(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'))") - .build() } #[derive(Debug)] @@ -136,7 +123,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_geometry_type_udf().into(); assert_eq!(udf.name(), "st_geometrytype"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_geomfromewkb.rs b/rust/sedona-functions/src/st_geomfromewkb.rs index 7634655b4..0baeed5cc 100644 --- a/rust/sedona-functions/src/st_geomfromewkb.rs +++ b/rust/sedona-functions/src/st_geomfromewkb.rs @@ -19,9 +19,7 @@ use std::{sync::Arc, vec}; use arrow_array::builder::{BinaryBuilder, StringViewBuilder}; use arrow_schema::DataType; use datafusion_common::{error::Result, exec_datafusion_err, ScalarValue}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::{ item_crs::make_item_crs, @@ -44,22 +42,8 @@ pub fn st_geomfromewkb_udf() -> SedonaScalarUDF { "st_geomfromewkb", vec![Arc::new(STGeomFromEWKB {})], Volatility::Immutable, - Some(doc()), - ) -} - -fn doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Construct a geometry from EWKB".to_string(), - "ST_GeomFromEWKB (Wkb: Binary)".to_string(), - ) - .with_argument( - "EWKB", - "binary: Extended well-known binary (EWKB) representation of the geometry".to_string(), + None, ) - .with_sql_example("SELECT ST_GeomFromEWKB([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00 00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])") - .build() } #[derive(Debug)] @@ -162,7 +146,7 @@ mod tests { fn udf_metadata() { let geog_from_wkb: ScalarUDF = st_geomfromewkb_udf().into(); assert_eq!(geog_from_wkb.name(), "st_geomfromewkb"); - assert!(geog_from_wkb.documentation().is_some()); + assert!(geog_from_wkb.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_geomfromwkb.rs b/rust/sedona-functions/src/st_geomfromwkb.rs index 38c4239b8..ff136a518 100644 --- a/rust/sedona-functions/src/st_geomfromwkb.rs +++ b/rust/sedona-functions/src/st_geomfromwkb.rs @@ -18,9 +18,7 @@ use std::{sync::Arc, vec}; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::{ datatypes::{SedonaType, WKB_GEOMETRY, WKB_VIEW_GEOGRAPHY, WKB_VIEW_GEOMETRY}, @@ -42,7 +40,7 @@ pub fn st_geomfromwkb_udf() -> SedonaScalarUDF { "st_geomfromwkb", vec![sridified_kernel, kernel], Volatility::Immutable, - Some(doc("ST_GeomFromWKB", "Geometry")), + None, ) } @@ -57,7 +55,7 @@ pub fn st_geomfromwkbunchecked_udf() -> SedonaScalarUDF { out_type: WKB_VIEW_GEOMETRY, })], Volatility::Immutable, - Some(doc_unchecked("ST_GeomFromWKBUnchecked", "Geometry")), + None, ) } @@ -72,49 +70,8 @@ pub fn st_geogfromwkb_udf() -> SedonaScalarUDF { out_type: WKB_VIEW_GEOGRAPHY, })], Volatility::Immutable, - Some(doc("ST_GeogFromWKB", "Geography")), - ) -} - -fn doc(name: &str, out_type_name: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("Construct a {out_type_name} from WKB"), - format!("{name} (Wkb: Binary)"), - ) - .with_argument( - "WKB", - format!( - "binary: Well-known binary representation of the {}", - out_type_name.to_lowercase() - ), - ) - .with_sql_example(format!("SELECT {name}([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00 00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])")) - .with_related_udf("ST_AsText") - .build() -} - -/// Documentation for `ST_GeomFromWKBUnchecked()`. -/// -/// Parameterized for reuse if `ST_GeogFromWKBUnchecked()` is implemented in the future. -fn doc_unchecked(name: &str, out_type_name: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Construct a {out_type_name} from WKB without validation. Invalid WKB input may result in undefined behavior." - ), - format!("{name} (Wkb: Binary)"), - ) - .with_argument( - "WKB", - format!( - "binary: Well-known binary representation of the {}", - out_type_name.to_lowercase() - ), + None, ) - .with_sql_example(format!("SELECT {name}([01 02 00 00 00 02 00 00 00 00 00 00 00 84 D6 00 C0 00 00 00 00 80 B5 D6 BF 00 00 00 60 E1 EF F7 BF 00 00 00 80 07 5D E5 BF])")) - .with_related_udf("ST_AsText") - .build() } #[derive(Debug)] @@ -181,15 +138,15 @@ mod tests { fn udf_metadata() { let geog_from_wkb: ScalarUDF = st_geogfromwkb_udf().into(); assert_eq!(geog_from_wkb.name(), "st_geogfromwkb"); - assert!(geog_from_wkb.documentation().is_some()); + assert!(geog_from_wkb.documentation().is_none()); let geom_from_wkb: ScalarUDF = st_geomfromwkb_udf().into(); assert_eq!(geom_from_wkb.name(), "st_geomfromwkb"); - assert!(geom_from_wkb.documentation().is_some()); + assert!(geom_from_wkb.documentation().is_none()); let geom_from_wkb_unchecked: ScalarUDF = st_geomfromwkbunchecked_udf().into(); assert_eq!(geom_from_wkb_unchecked.name(), "st_geomfromwkbunchecked"); - assert!(geom_from_wkb_unchecked.documentation().is_some()); + assert!(geom_from_wkb_unchecked.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_geomfromwkt.rs b/rust/sedona-functions/src/st_geomfromwkt.rs index 4bb5655f4..319aea761 100644 --- a/rust/sedona-functions/src/st_geomfromwkt.rs +++ b/rust/sedona-functions/src/st_geomfromwkt.rs @@ -22,9 +22,7 @@ use datafusion_common::cast::as_string_view_array; use datafusion_common::error::Result; use datafusion_common::exec_datafusion_err; use datafusion_common::scalar::ScalarValue; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_datafusion_err; use sedona_expr::item_crs::make_item_crs; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; @@ -54,7 +52,7 @@ pub fn st_geomfromwkt_udf() -> SedonaScalarUDF { "st_geomfromwkt", vec![sridified_kernel, kernel], Volatility::Immutable, - Some(doc("ST_GeomFromWKT", "Geometry")), + None, ); udf.with_aliases(vec![ "st_geomfromtext".to_string(), @@ -73,30 +71,11 @@ pub fn st_geogfromwkt_udf() -> SedonaScalarUDF { out_type: WKB_GEOGRAPHY, })], Volatility::Immutable, - Some(doc("ST_GeogFromWKT", "Geography")), + None, ); udf.with_aliases(vec!["st_geogfromtext".to_string()]) } -fn doc(name: &str, out_type_name: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!("Construct a {out_type_name} from WKT"), - format!("{name} (Wkt: String)"), - ) - .with_argument( - "WKT", - format!( - "string: Well-known text representation of the {}", - out_type_name.to_lowercase() - ), - ) - .with_argument("srid", "srid: EPSG code to set (e.g., 4326)") - .with_sql_example(format!("SELECT {name}('POINT(40.7128 -74.0060)')")) - .with_related_udf("ST_AsText") - .build() -} - #[derive(Debug)] struct STGeoFromWKT { out_type: SedonaType, @@ -155,23 +134,11 @@ fn invoke_scalar(wkt_bytes: &str, builder: &mut BinaryBuilder) -> Result<()> { /// /// An implementation of EWKT reading using GeoRust's wkt crate. pub fn st_geomfromewkt_udf() -> SedonaScalarUDF { - let doc = Documentation::builder( - DOC_SECTION_OTHER, - "Construct a Geometry from EWKT", - "ST_GeomFromEWKT (Ewkt: String)", - ) - .with_argument( - "EWKT", - "string: Extended well-known text representation of the geometry", - ) - .with_sql_example("SELECT ST_GeomFromEWKT('SRID=4326;POINT(40.7128 -74.0060)')") - .build(); - SedonaScalarUDF::new( "st_geomfromewkt", vec![Arc::new(STGeoFromEWKT {})], Volatility::Immutable, - Some(doc), + None, ) } @@ -295,11 +262,11 @@ mod tests { fn udf_metadata() { let geog_from_wkt: ScalarUDF = st_geogfromwkt_udf().into(); assert_eq!(geog_from_wkt.name(), "st_geogfromwkt"); - assert!(geog_from_wkt.documentation().is_some()); + assert!(geog_from_wkt.documentation().is_none()); let geom_from_wkt: ScalarUDF = st_geomfromwkt_udf().into(); assert_eq!(geom_from_wkt.name(), "st_geomfromwkt"); - assert!(geom_from_wkt.documentation().is_some()); + assert!(geom_from_wkt.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_haszm.rs b/rust/sedona-functions/src/st_haszm.rs index adfb161fd..8b30f0c31 100644 --- a/rust/sedona-functions/src/st_haszm.rs +++ b/rust/sedona-functions/src/st_haszm.rs @@ -20,9 +20,7 @@ use crate::executor::WkbBytesExecutor; use arrow_array::builder::BooleanBuilder; use arrow_schema::DataType; use datafusion_common::{error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -36,7 +34,7 @@ pub fn st_hasz_udf() -> SedonaScalarUDF { "st_hasz", ItemCrsKernel::wrap_impl(vec![Arc::new(STHasZm { dim: "z" })]), Volatility::Immutable, - Some(st_geometry_type_doc("z")), + None, ) } @@ -45,25 +43,8 @@ pub fn st_hasm_udf() -> SedonaScalarUDF { "st_hasm", ItemCrsKernel::wrap_impl(vec![Arc::new(STHasZm { dim: "m" })]), Volatility::Immutable, - Some(st_geometry_type_doc("m")), - ) -} - -fn st_geometry_type_doc(dim: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Return true if the geometry has a {} dimension", - dim.to_uppercase() - ), - format!("ST_Has{} (A: Geometry)", dim.to_uppercase()), + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example(format!( - "SELECT ST_Has{}(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'))", - dim.to_uppercase() - )) - .build() } #[derive(Debug)] @@ -158,11 +139,9 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_hasz_udf().into(); assert_eq!(udf.name(), "st_hasz"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_hasm_udf().into(); assert_eq!(udf.name(), "st_hasm"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_interiorringn.rs b/rust/sedona-functions/src/st_interiorringn.rs index b5234e3b3..943f409b5 100644 --- a/rust/sedona-functions/src/st_interiorringn.rs +++ b/rust/sedona-functions/src/st_interiorringn.rs @@ -20,7 +20,6 @@ use std::sync::Arc; use arrow_array::builder::BinaryBuilder; use datafusion_common::cast::as_int64_array; use datafusion_common::{DataFusionError, Result}; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation}; use geo_traits::{GeometryTrait, LineStringTrait, PolygonTrait}; use sedona_expr::item_crs::ItemCrsKernel; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; @@ -41,22 +40,10 @@ pub fn st_interiorringn_udf() -> SedonaScalarUDF { "st_interiorringn", ItemCrsKernel::wrap_impl(vec![Arc::new(STInteriorRingN)]), datafusion_expr::Volatility::Immutable, - Some(st_interiorringn_doc()), + None, ) } -fn st_interiorringn_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the Nth interior ring (hole) of a POLYGON geometry as a LINESTRING. \ - The index starts at 1. Returns NULL if the geometry is not a polygon or the index is out of range.", - "ST_GeometryN (geom: Geometry, n: integer)") - .with_argument("geom", "geometry: Input Polygon") - .with_argument("n", "n: Index") - .with_sql_example("SELECT ST_InteriorRingN('POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))', 1)") - .build() -} - #[derive(Debug)] struct STInteriorRingN; diff --git a/rust/sedona-functions/src/st_intersection_agg.rs b/rust/sedona-functions/src/st_intersection_agg.rs index fe4aa4f87..e78ca97ca 100644 --- a/rust/sedona-functions/src/st_intersection_agg.rs +++ b/rust/sedona-functions/src/st_intersection_agg.rs @@ -16,7 +16,7 @@ // under the License. use std::vec; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::aggregate_udf::SedonaAggregateUDF; use sedona_schema::{ datatypes::{Edges, SedonaType}, @@ -34,25 +34,10 @@ pub fn st_intersection_agg_udf() -> SedonaAggregateUDF { SedonaType::Wkb(Edges::Planar, None), ), Volatility::Immutable, - Some(st_intersection_agg_doc()), + None, ) } -fn st_intersection_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the polygon intersection of all polygons in geom.", - "ST_Intersection_Agg (A: Geometry, B: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example( - " - SELECT ST_Intersection_Agg(ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')), - ST_GeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))')", - ) - .build() -} - #[cfg(test)] mod test { use datafusion_expr::AggregateUDF; @@ -63,6 +48,5 @@ mod test { fn udf_metadata() { let udf: AggregateUDF = st_intersection_agg_udf().into(); assert_eq!(udf.name(), "st_intersection_agg"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_isclosed.rs b/rust/sedona-functions/src/st_isclosed.rs index d3c077c78..23e1ce36b 100644 --- a/rust/sedona-functions/src/st_isclosed.rs +++ b/rust/sedona-functions/src/st_isclosed.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use arrow_array::builder::BooleanBuilder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use geo_traits::GeometryCollectionTrait; use geo_traits::{ to_geo::{ToGeoLineString, ToGeoMultiLineString}, @@ -40,21 +40,10 @@ pub fn st_isclosed_udf() -> SedonaScalarUDF { "st_isclosed", ItemCrsKernel::wrap_impl(vec![Arc::new(STIsClosed {})]), Volatility::Immutable, - Some(st_is_closed_doc()), + None, ) } -fn st_is_closed_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return true if the geometry is closed", - "ST_IsClosed (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_IsClosed(ST_GeomFromWKT('LINESTRING(0 0, 1 1, 0 1, 0 0)'))") - .build() -} - #[derive(Debug)] struct STIsClosed {} @@ -140,7 +129,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_isclosed_udf().into(); assert_eq!(udf.name(), "st_isclosed"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_iscollection.rs b/rust/sedona-functions/src/st_iscollection.rs index d8717bf79..59db97619 100644 --- a/rust/sedona-functions/src/st_iscollection.rs +++ b/rust/sedona-functions/src/st_iscollection.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use arrow_array::builder::BooleanBuilder; use arrow_schema::DataType; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_common::sedona_internal_err; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -37,21 +37,10 @@ pub fn st_iscollection_udf() -> SedonaScalarUDF { "st_iscollection", ItemCrsKernel::wrap_impl(vec![Arc::new(STIsCollection {})]), Volatility::Immutable, - Some(st_iscollection_doc()), + None, ) } -fn st_iscollection_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return true if the geometry is a collection", - "ST_IsCollection (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_IsCollection(ST_GeomFromWKT('LINESTRING(0 0, 1 1, 0 1, 0 0)'))") - .build() -} - #[derive(Debug)] struct STIsCollection {} @@ -120,7 +109,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_iscollection_udf().into(); assert_eq!(udf.name(), "st_iscollection"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_isempty.rs b/rust/sedona-functions/src/st_isempty.rs index b12e2525c..2b6690eed 100644 --- a/rust/sedona-functions/src/st_isempty.rs +++ b/rust/sedona-functions/src/st_isempty.rs @@ -20,9 +20,7 @@ use crate::executor::WkbExecutor; use arrow_array::builder::BooleanBuilder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -36,19 +34,8 @@ pub fn st_isempty_udf() -> SedonaScalarUDF { "st_isempty", ItemCrsKernel::wrap_impl(vec![Arc::new(STIsEmpty {})]), Volatility::Immutable, - Some(st_is_empty_doc()), - ) -} - -fn st_is_empty_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return true if the geometry is empty", - "ST_IsEmpty (A: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_IsEmpty(ST_GeomFromWKT('POLYGON EMPTY'))") - .build() } #[derive(Debug)] @@ -116,7 +103,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_isempty_udf().into(); assert_eq!(udf.name(), "st_isempty"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_length.rs b/rust/sedona-functions/src/st_length.rs index e0f21c59b..9e329c288 100644 --- a/rust/sedona-functions/src/st_length.rs +++ b/rust/sedona-functions/src/st_length.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -30,27 +30,10 @@ pub fn st_length_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Float64), ), Volatility::Immutable, - Some(st_length_doc()), + None, ) } -fn st_length_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the length of geom. \ - This function only supports LineString, MultiLineString, and GeometryCollections \ - containing linear geometries. Use ST_Perimeter for polygons.\ - ", - "ST_Length (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example( - "SELECT ST_Length(ST_GeomFromWKT('LINESTRING(38 16,38 50,65 50,66 16,38 16)'))", - ) - .with_related_udf("ST_Perimeter") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -61,6 +44,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_length_udf().into(); assert_eq!(udf.name(), "st_length"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_line_merge.rs b/rust/sedona-functions/src/st_line_merge.rs index 2c409a11e..3eddfa9d4 100644 --- a/rust/sedona-functions/src/st_line_merge.rs +++ b/rust/sedona-functions/src/st_line_merge.rs @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -26,27 +26,10 @@ pub fn st_line_merge_udf() -> SedonaScalarUDF { "st_linemerge", ArgMatcher::new(vec![ArgMatcher::is_geometry()], WKB_GEOMETRY), Volatility::Immutable, - Some(st_line_merge_doc()), + None, ) } -fn st_line_merge_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Merge the line segments in a geometry", - "ST_LineMerge (Geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument( - "directed", - "If true, lines with opposite directions will not be merged", - ) - .with_sql_example( - "SELECT ST_LineMerge(ST_GeomFromWKT('MULTILINESTRING ((0 0, 1 0), (1 0, 1 1))'))", - ) - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -57,6 +40,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_line_merge_udf().into(); assert_eq!(udf.name(), "st_linemerge"); - assert!(udf.documentation().is_some()) } } diff --git a/rust/sedona-functions/src/st_makeline.rs b/rust/sedona-functions/src/st_makeline.rs index c25213396..713845531 100644 --- a/rust/sedona-functions/src/st_makeline.rs +++ b/rust/sedona-functions/src/st_makeline.rs @@ -20,9 +20,7 @@ use arrow_array::builder::BinaryBuilder; use datafusion_common::error::Result; use datafusion_common::exec_err; use datafusion_common::DataFusionError; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{CoordTrait, GeometryTrait, LineStringTrait, MultiPointTrait, PointTrait}; use sedona_common::sedona_internal_err; use sedona_expr::item_crs::ItemCrsKernel; @@ -52,20 +50,8 @@ pub fn st_makeline_udf() -> SedonaScalarUDF { }), ]), Volatility::Immutable, - Some(doc()), - ) -} - -fn doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Construct a line".to_string(), - "ST_MakeLine (g1: Geometry or Geography, g2: Geometry or Geography)".to_string(), + None, ) - .with_argument("g1", "Geometry or Geography: The first point or geometry") - .with_argument("g2", "Geometry or Geography: The second point or geometry") - .with_sql_example("SELECT ST_MakeLine(ST_Point(0, 1), ST_Point(2, 3)) as geom") - .build() } #[derive(Debug)] @@ -224,7 +210,7 @@ mod tests { fn udf_metadata() { let geom_from_point: ScalarUDF = st_makeline_udf().into(); assert_eq!(geom_from_point.name(), "st_makeline"); - assert!(geom_from_point.documentation().is_some()); + assert!(geom_from_point.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_numgeometries.rs b/rust/sedona-functions/src/st_numgeometries.rs index b7e8abe72..ebbad1d6e 100644 --- a/rust/sedona-functions/src/st_numgeometries.rs +++ b/rust/sedona-functions/src/st_numgeometries.rs @@ -20,7 +20,7 @@ use std::sync::Arc; use arrow_array::builder::UInt32Builder; use arrow_schema::DataType; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_common::sedona_internal_err; use sedona_expr::{ item_crs::ItemCrsKernel, @@ -37,21 +37,10 @@ pub fn st_numgeometries_udf() -> SedonaScalarUDF { "st_numgeometries", ItemCrsKernel::wrap_impl(vec![Arc::new(STNumGeometries {})]), Volatility::Immutable, - Some(st_numgeometries_doc()), + None, ) } -fn st_numgeometries_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the number of geometries in the geometry collection", - "ST_NumGeometries (A: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_NumGeometries(ST_GeomFromWKT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1))'))") - .build() -} - #[derive(Debug)] struct STNumGeometries {} @@ -130,7 +119,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_numgeometries_udf().into(); assert_eq!(udf.name(), "st_numgeometries"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-functions/src/st_perimeter.rs b/rust/sedona-functions/src/st_perimeter.rs index d6e0208a1..52158d3bf 100644 --- a/rust/sedona-functions/src/st_perimeter.rs +++ b/rust/sedona-functions/src/st_perimeter.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. use arrow_schema::DataType; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -34,27 +34,10 @@ pub fn st_perimeter_udf() -> SedonaScalarUDF { SedonaType::Arrow(DataType::Float64), ), Volatility::Immutable, - Some(st_perimeter_doc()), + None, ) } -fn st_perimeter_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Introduction: This function calculates the 2D perimeter of a given geometry. It supports Polygon, MultiPolygon, and GeometryCollection geometries (as long as the GeometryCollection contains polygonal geometries). For other types, it returns 0. To measure lines, use ST_Length.\n\ - To get the perimeter in meters, set use_spheroid to true. This calculates the geodesic perimeter using the WGS84 spheroid. When using use_spheroid, the lenient parameter defaults to true, assuming the geometry uses EPSG:4326. To throw an exception instead, set lenient to false.", - "ST_Perimeter(geom: Geometry)" - ) - .with_syntax_example("ST_Perimeter(geom: Geometry, use_spheroid: Boolean)") - .with_syntax_example("ST_Perimeter(geom: Geometry, use_spheroid: Boolean, lenient: Boolean = True)") - .with_sql_example("SELECT ST_Perimeter(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'))") - .with_sql_example("SELECT ST_Perimeter(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))', 4326), true, false)") - .with_argument("geom", "geometry: Input geometry") - .with_argument("use_spheroid", "boolean: If true, calculates the geodesic perimeter using the WGS84 spheroid. Defaults to false.") - .with_argument("lenient", "boolean: If true, assumes the geometry uses EPSG:4326 when use_spheroid is true. Defaults to true.") - .build() -} - #[cfg(test)] mod tests { use datafusion_expr::ScalarUDF; @@ -65,6 +48,5 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_perimeter_udf().into(); assert_eq!(udf.name(), "st_perimeter"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_point.rs b/rust/sedona-functions/src/st_point.rs index de3e279ee..b3f4c6f14 100644 --- a/rust/sedona-functions/src/st_point.rs +++ b/rust/sedona-functions/src/st_point.rs @@ -21,9 +21,7 @@ use arrow_schema::DataType; use datafusion_common::cast::as_float64_array; use datafusion_common::error::Result; use datafusion_common::scalar::ScalarValue; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::{ datatypes::{SedonaType, WKB_GEOGRAPHY, WKB_GEOMETRY}, @@ -46,7 +44,7 @@ pub fn st_point_udf() -> SedonaScalarUDF { "st_point", vec![sridified_kernel, kernel], Volatility::Immutable, - Some(doc("ST_Point", "Geometry")), + None, ) } @@ -64,24 +62,8 @@ pub fn st_geogpoint_udf() -> SedonaScalarUDF { "st_geogpoint", vec![sridified_kernel, kernel], Volatility::Immutable, - Some(doc("st_geogpoint", "Geography")), - ) -} - -fn doc(name: &str, out_type_name: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Construct a Point {} from X and Y", - out_type_name.to_lowercase() - ), - format!("{name} (x: Double, y: Double)"), + None, ) - .with_argument("x", "double: X value") - .with_argument("y", "double: Y value") - .with_argument("srid", "srid: EPSG code to set (e.g., 4326)") - .with_sql_example(format!("{name}(-64.36, 45.09)")) - .build() } #[derive(Debug)] @@ -179,11 +161,11 @@ mod tests { fn udf_metadata() { let geom_from_point: ScalarUDF = st_point_udf().into(); assert_eq!(geom_from_point.name(), "st_point"); - assert!(geom_from_point.documentation().is_some()); + assert!(geom_from_point.documentation().is_none()); let geog_from_point: ScalarUDF = st_geogpoint_udf().into(); assert_eq!(geog_from_point.name(), "st_geogpoint"); - assert!(geog_from_point.documentation().is_some()); + assert!(geog_from_point.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_pointn.rs b/rust/sedona-functions/src/st_pointn.rs index b7acb6888..2aac18e56 100644 --- a/rust/sedona-functions/src/st_pointn.rs +++ b/rust/sedona-functions/src/st_pointn.rs @@ -17,9 +17,7 @@ use arrow_array::builder::BinaryBuilder; use arrow_schema::DataType; use datafusion_common::{error::Result, ScalarValue}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{CoordTrait, GeometryTrait, LineStringTrait}; use sedona_common::sedona_internal_err; use sedona_expr::{ @@ -46,20 +44,8 @@ pub fn st_pointn_udf() -> SedonaScalarUDF { "st_pointn", ItemCrsKernel::wrap_impl(vec![Arc::new(STPointN)]), Volatility::Immutable, - Some(st_pointn_doc()), - ) -} - -fn st_pointn_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the nth point of a geometry. Returns NULL if the geometry is empty or not a LINESTRING. Negative values are counted backwards from the end.", - "ST_PointN (geom: Geometry, n: integer)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("n", "n: Index") - .with_sql_example("SELECT ST_PointN(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'), 2)") - .build() } #[derive(Debug)] @@ -155,7 +141,7 @@ mod tests { fn udf_metadata() { let st_pointn_udf: ScalarUDF = st_pointn_udf().into(); assert_eq!(st_pointn_udf.name(), "st_pointn"); - assert!(st_pointn_udf.documentation().is_some()); + assert!(st_pointn_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_points.rs b/rust/sedona-functions/src/st_points.rs index 676a14b55..03043ae60 100644 --- a/rust/sedona-functions/src/st_points.rs +++ b/rust/sedona-functions/src/st_points.rs @@ -17,9 +17,7 @@ use arrow_array::builder::{BinaryBuilder, UInt64Builder}; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{ CoordTrait, GeometryCollectionTrait, GeometryTrait, LineStringTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait, @@ -52,19 +50,8 @@ pub fn st_points_udf() -> SedonaScalarUDF { "st_points", ItemCrsKernel::wrap_impl(vec![Arc::new(STPoints)]), Volatility::Immutable, - Some(st_points_doc()), - ) -} - -fn st_points_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns all the points of a geometry as MULTIPOINT.", - "ST_Points (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_Points(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'))") - .build() } #[derive(Debug)] @@ -121,19 +108,8 @@ pub fn st_npoints_udf() -> SedonaScalarUDF { "st_npoints", ItemCrsKernel::wrap_impl(vec![Arc::new(STNPoints)]), Volatility::Immutable, - Some(st_npoints_doc()), - ) -} - -fn st_npoints_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the count of the points of a geometry.", - "ST_Points (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_NPoints(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'))") - .build() } #[derive(Debug)] @@ -308,11 +284,11 @@ mod tests { fn udf_metadata() { let st_points_udf: ScalarUDF = st_points_udf().into(); assert_eq!(st_points_udf.name(), "st_points"); - assert!(st_points_udf.documentation().is_some()); + assert!(st_points_udf.documentation().is_none()); let st_npoints_udf: ScalarUDF = st_npoints_udf().into(); assert_eq!(st_npoints_udf.name(), "st_npoints"); - assert!(st_npoints_udf.documentation().is_some()); + assert!(st_npoints_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_pointzm.rs b/rust/sedona-functions/src/st_pointzm.rs index 59f9f43d3..84e6d8174 100644 --- a/rust/sedona-functions/src/st_pointzm.rs +++ b/rust/sedona-functions/src/st_pointzm.rs @@ -26,9 +26,7 @@ use datafusion_common::cast::as_float64_array; use datafusion_common::error::Result; use datafusion_common::scalar::ScalarValue; use datafusion_common::DataFusionError; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_common::{sedona_internal_datafusion_err, sedona_internal_err}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; @@ -57,7 +55,7 @@ pub fn st_pointz_udf() -> SedonaScalarUDF { dim: Dimensions::Xyz, })], Volatility::Immutable, - Some(three_coord_point_doc("ST_PointZ", "Geometry", "Z")), + None, ) } @@ -72,7 +70,7 @@ pub fn st_pointm_udf() -> SedonaScalarUDF { dim: Dimensions::Xym, })], Volatility::Immutable, - Some(three_coord_point_doc("ST_PointM", "Geometry", "M")), + None, ) } @@ -87,45 +85,8 @@ pub fn st_pointzm_udf() -> SedonaScalarUDF { dim: Dimensions::Xyzm, })], Volatility::Immutable, - Some(xyzm_point_doc("ST_PointZM", "Geometry")), - ) -} - -fn three_coord_point_doc(name: &str, out_type_name: &str, third_dim: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Construct a Point {} from X, Y and {}", - out_type_name.to_lowercase(), - third_dim - ), - format!("{name} (x: Double, y: Double, z: Double)"), - ) - .with_argument("x", "double: X value") - .with_argument("y", "double: Y value") - .with_argument( - third_dim.to_lowercase(), - format!("double: {third_dim} value"), - ) - .with_sql_example(format!("{name}(-64.36, 45.09, 100.0)")) - .build() -} - -fn xyzm_point_doc(name: &str, out_type_name: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Construct a Point {} from X, Y, Z and M", - out_type_name.to_lowercase() - ), - format!("{name} (x: Double, y: Double, z: Double)"), + None, ) - .with_argument("x", "double: X value") - .with_argument("y", "double: Y value") - .with_argument("z", "double: Z value") - .with_argument("m", "double: M value") - .with_sql_example(format!("{name}(-64.36, 45.09, 100.0, 50.0)")) - .build() } #[derive(Debug)] @@ -265,15 +226,15 @@ mod tests { fn udf_metadata() { let pointz: ScalarUDF = st_pointz_udf().into(); assert_eq!(pointz.name(), "st_pointz"); - assert!(pointz.documentation().is_some()); + assert!(pointz.documentation().is_none()); let pointm: ScalarUDF = st_pointm_udf().into(); assert_eq!(pointm.name(), "st_pointm"); - assert!(pointm.documentation().is_some()); + assert!(pointm.documentation().is_none()); let pointzm: ScalarUDF = st_pointzm_udf().into(); assert_eq!(pointzm.name(), "st_pointzm"); - assert!(pointzm.documentation().is_some()); + assert!(pointzm.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_polygonize_agg.rs b/rust/sedona-functions/src/st_polygonize_agg.rs index 477a65235..8d4dbcbb6 100644 --- a/rust/sedona-functions/src/st_polygonize_agg.rs +++ b/rust/sedona-functions/src/st_polygonize_agg.rs @@ -16,7 +16,7 @@ // under the License. use std::vec; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::aggregate_udf::SedonaAggregateUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -28,28 +28,10 @@ pub fn st_polygonize_agg_udf() -> SedonaAggregateUDF { "st_polygonize_agg", ArgMatcher::new(vec![ArgMatcher::is_geometry()], WKB_GEOMETRY), Volatility::Immutable, - Some(st_polygonize_agg_doc()), + None, ) } -fn st_polygonize_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Creates a GeometryCollection containing polygons formed from the linework of a set of geometries. \ - Returns an empty GeometryCollection if no polygons can be formed.", - "ST_Polygonize_Agg (geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry (typically linestrings that form closed rings)") - .with_sql_example( - "SELECT ST_AsText(ST_Polygonize_Agg(geom)) FROM (VALUES \ - (ST_GeomFromText('LINESTRING (0 0, 10 0)')), \ - (ST_GeomFromText('LINESTRING (10 0, 10 10)')), \ - (ST_GeomFromText('LINESTRING (10 10, 0 0)')) \ - ) AS t(geom)" - ) - .build() -} - #[cfg(test)] mod test { use datafusion_expr::AggregateUDF; @@ -60,6 +42,5 @@ mod test { fn udf_metadata() { let udf: AggregateUDF = st_polygonize_agg_udf().into(); assert_eq!(udf.name(), "st_polygonize_agg"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_reverse.rs b/rust/sedona-functions/src/st_reverse.rs index 71dd34468..0dbff881c 100644 --- a/rust/sedona-functions/src/st_reverse.rs +++ b/rust/sedona-functions/src/st_reverse.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use arrow_array::builder::BinaryBuilder; use datafusion_common::{DataFusionError, Result}; use datafusion_expr::ColumnarValue; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use geo_traits::{ CoordTrait, GeometryCollectionTrait, GeometryTrait, LineStringTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait, @@ -49,21 +49,10 @@ pub fn st_reverse_udf() -> SedonaScalarUDF { "st_reverse", ItemCrsKernel::wrap_impl(vec![Arc::new(STReverse)]), Volatility::Immutable, - Some(st_reverse_doc()), + None, ) } -fn st_reverse_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Can be used on any geometry and reverses the order of the vertices.", - "ST_Reverse (geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_AsText(ST_Reverse('POLYGON ((2 2, 2 3, 3 3, 3 2, 2 2))'))") - .build() -} - #[derive(Debug)] struct STReverse; diff --git a/rust/sedona-functions/src/st_rotate.rs b/rust/sedona-functions/src/st_rotate.rs index c60781fca..a0753d49d 100644 --- a/rust/sedona-functions/src/st_rotate.rs +++ b/rust/sedona-functions/src/st_rotate.rs @@ -17,9 +17,7 @@ use arrow_array::builder::BinaryBuilder; use arrow_schema::DataType; use datafusion_common::{error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -46,7 +44,7 @@ pub fn st_rotate_udf() -> SedonaScalarUDF { axis: RotateAxis::Z, })]), Volatility::Immutable, - Some(st_rotate_doc("")), + None, ) } @@ -60,7 +58,7 @@ pub fn st_rotate_x_udf() -> SedonaScalarUDF { axis: RotateAxis::X, })]), Volatility::Immutable, - Some(st_rotate_doc("X")), + None, ) } @@ -74,26 +72,8 @@ pub fn st_rotate_y_udf() -> SedonaScalarUDF { axis: RotateAxis::Y, })]), Volatility::Immutable, - Some(st_rotate_doc("Y")), - ) -} - -fn st_rotate_doc(axis: &str) -> Documentation { - let suffix = match axis { - "Z" => "", - _ => axis, - }; - Documentation::builder( - DOC_SECTION_OTHER, - format!("Rotates a geometry by a specified angle in radians counter-clockwise around the {axis}-axis "), - format!("ST_Rotate{suffix} (geom: Geometry, rot: Double)"), - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("rot", "angle (in radians)") - .with_sql_example( - format!("SELECT ST_Rotate{suffix}(ST_GeomFromText('POLYGON Z ((1 0 1, 1 1 1, 2 2 2, 1 0 1))'), radians(45))"), + None, ) - .build() } #[derive(Debug)] @@ -164,15 +144,15 @@ mod tests { fn udf_metadata() { let st_rotate_udf: ScalarUDF = st_rotate_udf().into(); assert_eq!(st_rotate_udf.name(), "st_rotate"); - assert!(st_rotate_udf.documentation().is_some()); + assert!(st_rotate_udf.documentation().is_none()); let st_rotate_x_udf: ScalarUDF = st_rotate_x_udf().into(); assert_eq!(st_rotate_x_udf.name(), "st_rotatex"); - assert!(st_rotate_x_udf.documentation().is_some()); + assert!(st_rotate_x_udf.documentation().is_none()); let st_rotate_y_udf: ScalarUDF = st_rotate_y_udf().into(); assert_eq!(st_rotate_y_udf.name(), "st_rotatey"); - assert!(st_rotate_y_udf.documentation().is_some()); + assert!(st_rotate_y_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_scale.rs b/rust/sedona-functions/src/st_scale.rs index 419e08100..52b626bab 100644 --- a/rust/sedona-functions/src/st_scale.rs +++ b/rust/sedona-functions/src/st_scale.rs @@ -17,9 +17,7 @@ use arrow_array::{builder::BinaryBuilder, Array}; use arrow_schema::DataType; use datafusion_common::{error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::{ item_crs::ItemCrsKernel, scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}, @@ -47,24 +45,8 @@ pub fn st_scale_udf() -> SedonaScalarUDF { Arc::new(STScale { is_3d: false }), ]), Volatility::Immutable, - Some(st_scale_doc()), - ) -} - -fn st_scale_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Scales the geometry to a new size by multiplying the ordinates with the corresponding scaling factors", - "ST_Scale (geom: Geometry, scaleX: Double, scaleY: Double, scaleZ: Double)", - ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("scaleX", "scaling factor for X") - .with_argument("scaleY", "scaling factor for Y") - .with_argument("scaleZ", "scaling factor for Z") - .with_sql_example( - "SELECT ST_Scale(ST_GeomFromText('POLYGON Z ((1 0 1, 1 1 1, 2 2 2, 1 0 1))'), 1, 2, 3)", + None, ) - .build() } #[derive(Debug)] @@ -153,7 +135,7 @@ mod tests { fn udf_metadata() { let st_scale_udf: ScalarUDF = st_scale_udf().into(); assert_eq!(st_scale_udf.name(), "st_scale"); - assert!(st_scale_udf.documentation().is_some()); + assert!(st_scale_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_setsrid.rs b/rust/sedona-functions/src/st_setsrid.rs index 78fe9ae6e..79a95a44c 100644 --- a/rust/sedona-functions/src/st_setsrid.rs +++ b/rust/sedona-functions/src/st_setsrid.rs @@ -31,9 +31,7 @@ use datafusion_common::{ error::Result, DataFusionError, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::{ item_crs::{ @@ -57,7 +55,7 @@ pub fn st_set_srid_with_engine_udf( "st_setsrid", vec![Arc::new(STSetSRID { engine })], Volatility::Immutable, - Some(set_srid_doc()), + None, ) } @@ -73,7 +71,7 @@ pub fn st_set_crs_with_engine_udf( "st_setcrs", vec![Arc::new(STSetCRS { engine })], Volatility::Immutable, - Some(set_crs_doc()), + None, ) } @@ -91,35 +89,6 @@ pub fn st_set_crs_udf() -> SedonaScalarUDF { st_set_crs_with_engine_udf(None) } -fn set_srid_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Sets the spatial reference system identifier (SRID) of the geometry.", - "ST_SetSRID (geom: Geometry, srid: Integer)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_argument("srid", "srid: EPSG code to set (e.g., 4326)") - .with_sql_example("SELECT ST_GeomFromWKT('POINT (-64.363049 45.091501)', 4326)".to_string()) - .build() -} - -fn set_crs_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Set CRS information for a geometry or geography", - "ST_SetCrs (geom: Geometry, crs: String)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_argument( - "crs", - "string: Coordinate reference system identifier (e.g., 'OGC:CRS84')", - ) - .with_sql_example( - "SELECT ST_SetCrs(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 'OGC:CRS84')".to_string(), - ) - .build() -} - #[derive(Debug)] struct STSetSRID { engine: Option>, @@ -590,11 +559,9 @@ mod test { fn udf_metadata() { let udf: ScalarUDF = st_set_srid_udf().into(); assert_eq!(udf.name(), "st_setsrid"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_set_crs_udf().into(); assert_eq!(udf.name(), "st_setcrs"); - assert!(udf.documentation().is_some()); } #[test] diff --git a/rust/sedona-functions/src/st_srid.rs b/rust/sedona-functions/src/st_srid.rs index cda4ec21d..323239849 100644 --- a/rust/sedona-functions/src/st_srid.rs +++ b/rust/sedona-functions/src/st_srid.rs @@ -25,9 +25,7 @@ use datafusion_common::{ cast::{as_string_view_array, as_struct_array}, DataFusionError, Result, ScalarValue, }; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_common::sedona_internal_err; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_schema::crs::CachedCrsToSRIDMapping; @@ -43,7 +41,7 @@ pub fn st_srid_udf() -> SedonaScalarUDF { "st_srid", vec![Arc::new(StSridItemCrs {}), Arc::new(StSrid {})], Volatility::Immutable, - Some(st_srid_doc()), + None, ) } @@ -55,30 +53,8 @@ pub fn st_crs_udf() -> SedonaScalarUDF { "st_crs", vec![Arc::new(StCrsItemCrs {}), Arc::new(StCrs {})], Volatility::Immutable, - Some(st_crs_doc()), - ) -} - -fn st_srid_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the spatial reference system identifier (SRID) of the geometry.", - "ST_SRID (geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_SRID(polygon)".to_string()) - .build() -} - -fn st_crs_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the coordinate reference system (CRS) of the geometry.", - "ST_CRS (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_CRS(polygon)".to_string()) - .build() } #[derive(Debug)] @@ -302,11 +278,9 @@ mod test { fn udf_metadata() { let udf: ScalarUDF = st_srid_udf().into(); assert_eq!(udf.name(), "st_srid"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_crs_udf().into(); assert_eq!(udf.name(), "st_crs"); - assert!(udf.documentation().is_some()) } #[test] diff --git a/rust/sedona-functions/src/st_start_point.rs b/rust/sedona-functions/src/st_start_point.rs index 91e9307c7..1f510a766 100644 --- a/rust/sedona-functions/src/st_start_point.rs +++ b/rust/sedona-functions/src/st_start_point.rs @@ -16,9 +16,7 @@ // under the License. use arrow_array::builder::BinaryBuilder; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{ CoordTrait, GeometryCollectionTrait, GeometryTrait, LineStringTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait, @@ -48,19 +46,8 @@ pub fn st_start_point_udf() -> SedonaScalarUDF { "st_startpoint", ItemCrsKernel::wrap_impl(vec![Arc::new(STStartOrEndPoint::new(true))]), Volatility::Immutable, - Some(st_start_point_doc()), - ) -} - -fn st_start_point_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the start point of a geometry. Returns NULL if the geometry is empty.", - "ST_StartPoint (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_StartPoint(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'))") - .build() } /// ST_EndPoint() scalar UDF @@ -71,19 +58,8 @@ pub fn st_end_point_udf() -> SedonaScalarUDF { "st_endpoint", ItemCrsKernel::wrap_impl(vec![Arc::new(STStartOrEndPoint::new(false))]), Volatility::Immutable, - Some(st_end_point_doc()), - ) -} - -fn st_end_point_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the end point of a LINESTRING geometry. Returns NULL if the geometry is empty or not a LINESTRING.", - "ST_EndPoint (geom: Geometry)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_EndPoint(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'))") - .build() } #[derive(Debug)] @@ -208,11 +184,11 @@ mod tests { fn udf_metadata() { let st_start_point_udf: ScalarUDF = st_start_point_udf().into(); assert_eq!(st_start_point_udf.name(), "st_startpoint"); - assert!(st_start_point_udf.documentation().is_some()); + assert!(st_start_point_udf.documentation().is_none()); let st_end_point_udf: ScalarUDF = st_end_point_udf().into(); assert_eq!(st_end_point_udf.name(), "st_endpoint"); - assert!(st_end_point_udf.documentation().is_some()); + assert!(st_end_point_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_transform.rs b/rust/sedona-functions/src/st_transform.rs index dab708bad..f308e5f6d 100644 --- a/rust/sedona-functions/src/st_transform.rs +++ b/rust/sedona-functions/src/st_transform.rs @@ -16,7 +16,7 @@ // under the License. use std::vec; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::scalar_udf::SedonaScalarUDF; use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher}; @@ -39,46 +39,10 @@ pub fn st_transform_udf() -> SedonaScalarUDF { WKB_GEOMETRY, ), Volatility::Immutable, - Some(st_transform_doc()), + None, ) } -fn st_transform_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Introduction: -Transform the Spatial Reference System / Coordinate Reference System of A, from SourceCRS to TargetCRS. If the SourceCRS is not specified, CRS will be fetched from the geometry column. - -Lon/Lat Order in the input geometry - -If the input geometry is in lat/lon order, it might throw an error such as too close to pole, latitude or longitude exceeded limits, or give unexpected results. You need to make sure that the input geometry is in lon/lat order. If the input geometry is in lat/lon order, you can use ST_FlipCoordinates to swap X and Y. - -Lon/Lat Order in the source and target CRS - -Sedona will make sure the source and target CRS are in lon/lat order. If the source CRS or target CRS is in lat/lon order, these CRS will be swapped to lon/lat order. - -CRS code - -The CRS code is the code of the CRS in the official EPSG database (https://epsg.org/) in the format of EPSG:XXXX. A community tool https://spatialreference.org can help you quick identify a CRS code. For example, the code of WGS84 is EPSG:4326. - -CRS format - -You can use any string accepted by PROJ to specify a CRS (e.g., PROJJSON, WKT1/2, authority/code in the form authority:code). -","ST_Transform (A: Geometry, SourceCRS: String, TargetCRS: String)") - .with_argument("geom", "geometry: Input geometry") - .with_argument("source_crs", "string: Source CRS code or WKT") - .with_argument("target_crs", "string: Target CRS code or WKT") - .with_argument("lenient", "boolean: If true, assumes the geometry uses EPSG:4326 when source_crs is not specified. Defaults to true.") - .with_sql_example( - " - SELECT ST_Transform(ST_GeomFromWkt('POLYGON((170 50,170 72,-130 72,-130 50,170 50))'),'EPSG:4326', 'EPSG:32649')" - ) - .with_sql_example("SELECT ST_Transform(ST_GeomFromWkt('POLYGON((170 50,170 72,-130 72,-130 50,170 50))'),'EPSG:4326', 'EPSG:32649', false)") - .with_syntax_example("ST_Transform (A: Geometry, SourceCRS: String, TargetCRS: String)") - .with_syntax_example("ST_Transform (A: Geometry, TargetCRS: String)") - .build() -} - #[cfg(test)] mod test { use super::*; @@ -88,6 +52,5 @@ mod test { fn udf_metadata() { let udf: SedonaScalarUDF = st_transform_udf(); assert_eq!(udf.name(), "st_transform"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_translate.rs b/rust/sedona-functions/src/st_translate.rs index 2fac1c800..4d50080b8 100644 --- a/rust/sedona-functions/src/st_translate.rs +++ b/rust/sedona-functions/src/st_translate.rs @@ -17,9 +17,7 @@ use arrow_array::{builder::BinaryBuilder, types::Float64Type, Array, PrimitiveArray}; use arrow_schema::DataType; use datafusion_common::{cast::as_float64_array, error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_common::sedona_internal_err; @@ -49,21 +47,8 @@ pub fn st_translate_udf() -> SedonaScalarUDF { Arc::new(STTranslate { is_3d: false }), ]), Volatility::Immutable, - Some(st_translate_doc()), - ) -} - -fn st_translate_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Update coordinates of geom by a fixed offset", - "ST_Translate (geom: Geometry, deltax: numeric, deltay: numeric)", + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_argument("deltax", "numeric: X value difference") - .with_argument("deltay", "numeric: Y value difference") - .with_sql_example("SELECT ST_Translate(ST_GeomFromWKT('LINESTRING(0 1, 2 3, 4 5)'), 2.0, 3.0)") - .build() } #[derive(Debug)] @@ -261,7 +246,7 @@ mod tests { fn udf_metadata() { let st_translate_udf: ScalarUDF = st_translate_udf().into(); assert_eq!(st_translate_udf.name(), "st_translate"); - assert!(st_translate_udf.documentation().is_some()); + assert!(st_translate_udf.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_union_agg.rs b/rust/sedona-functions/src/st_union_agg.rs index 63f5195ce..4e65995ed 100644 --- a/rust/sedona-functions/src/st_union_agg.rs +++ b/rust/sedona-functions/src/st_union_agg.rs @@ -16,7 +16,7 @@ // under the License. use std::vec; -use datafusion_expr::{scalar_doc_sections::DOC_SECTION_OTHER, Documentation, Volatility}; +use datafusion_expr::Volatility; use sedona_expr::aggregate_udf::SedonaAggregateUDF; use sedona_schema::{ datatypes::{Edges, SedonaType}, @@ -34,21 +34,10 @@ pub fn st_union_agg_udf() -> SedonaAggregateUDF { SedonaType::Wkb(Edges::Planar, None), ), Volatility::Immutable, - Some(st_union_agg_doc()), + None, ) } -fn st_union_agg_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the geometric union of all geometries in the input column.", - "ST_Union_Agg (geom: Geometry)", - ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example("SELECT ST_Union_Agg(ST_GeomFromWKT('POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))'))") - .build() -} - #[cfg(test)] mod test { use datafusion_expr::AggregateUDF; @@ -59,6 +48,5 @@ mod test { fn udf_metadata() { let udf: AggregateUDF = st_union_agg_udf().into(); assert_eq!(udf.name(), "st_union_agg"); - assert!(udf.documentation().is_some()); } } diff --git a/rust/sedona-functions/src/st_xyzm.rs b/rust/sedona-functions/src/st_xyzm.rs index 9fa7697bc..b8dfe9268 100644 --- a/rust/sedona-functions/src/st_xyzm.rs +++ b/rust/sedona-functions/src/st_xyzm.rs @@ -20,9 +20,7 @@ use crate::executor::WkbExecutor; use arrow_array::builder::Float64Builder; use arrow_schema::DataType; use datafusion_common::error::{DataFusionError, Result}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::{ CoordTrait, Dimensions, GeometryCollectionTrait, GeometryTrait, LineStringTrait, MultiLineStringTrait, MultiPointTrait, MultiPolygonTrait, PointTrait, PolygonTrait, @@ -43,7 +41,7 @@ pub fn st_x_udf() -> SedonaScalarUDF { "st_x", ItemCrsKernel::wrap_impl(vec![Arc::new(STXyzm { dim: "x" })]), Volatility::Immutable, - Some(st_xy_doc("x")), + None, ) } @@ -55,7 +53,7 @@ pub fn st_y_udf() -> SedonaScalarUDF { "st_y", ItemCrsKernel::wrap_impl(vec![Arc::new(STXyzm { dim: "y" })]), Volatility::Immutable, - Some(st_xy_doc("y")), + None, ) } @@ -67,7 +65,7 @@ pub fn st_z_udf() -> SedonaScalarUDF { "st_z", ItemCrsKernel::wrap_impl(vec![Arc::new(STXyzm { dim: "z" })]), Volatility::Immutable, - Some(st_xy_doc("z")), + None, ) } @@ -79,25 +77,8 @@ pub fn st_m_udf() -> SedonaScalarUDF { "st_m", ItemCrsKernel::wrap_impl(vec![Arc::new(STXyzm { dim: "m" })]), Volatility::Immutable, - Some(st_xy_doc("m")), - ) -} - -fn st_xy_doc(dim: &str) -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Return the {} component of a point geometry or geography", - dim.to_uppercase() - ), - format!("ST_{}(A: Point)", dim.to_uppercase()), + None, ) - .with_argument("geom", "geometry: Input geometry or geography") - .with_sql_example(format!( - "SELECT ST_{}(ST_Point(1.0, 2.0))", - dim.to_uppercase() - )) - .build() } #[derive(Debug)] @@ -250,19 +231,19 @@ mod tests { fn udf_metadata() { let udf_x: ScalarUDF = st_x_udf().into(); assert_eq!(udf_x.name(), "st_x"); - assert!(udf_x.documentation().is_some()); + assert!(udf_x.documentation().is_none()); let udf_y: ScalarUDF = st_y_udf().into(); assert_eq!(udf_y.name(), "st_y"); - assert!(udf_y.documentation().is_some()); + assert!(udf_y.documentation().is_none()); let udf_z: ScalarUDF = st_z_udf().into(); assert_eq!(udf_z.name(), "st_z"); - assert!(udf_z.documentation().is_some()); + assert!(udf_z.documentation().is_none()); let udf_m: ScalarUDF = st_m_udf().into(); assert_eq!(udf_m.name(), "st_m"); - assert!(udf_m.documentation().is_some()); + assert!(udf_m.documentation().is_none()); } #[rstest] diff --git a/rust/sedona-functions/src/st_xyzm_minmax.rs b/rust/sedona-functions/src/st_xyzm_minmax.rs index 8617d6adc..4feaec713 100644 --- a/rust/sedona-functions/src/st_xyzm_minmax.rs +++ b/rust/sedona-functions/src/st_xyzm_minmax.rs @@ -20,9 +20,7 @@ use crate::executor::WkbExecutor; use arrow_array::builder::Float64Builder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::GeometryTrait; use sedona_common::{sedona_internal_datafusion_err, sedona_internal_err}; use sedona_expr::{ @@ -43,7 +41,7 @@ pub fn st_xmin_udf() -> SedonaScalarUDF { is_max: false, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("x", false)), + None, ) } @@ -55,7 +53,7 @@ pub fn st_xmax_udf() -> SedonaScalarUDF { is_max: true, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("x", true)), + None, ) } @@ -67,7 +65,7 @@ pub fn st_ymin_udf() -> SedonaScalarUDF { is_max: false, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("y", false)), + None, ) } @@ -79,7 +77,7 @@ pub fn st_ymax_udf() -> SedonaScalarUDF { is_max: true, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("y", true)), + None, ) } @@ -91,7 +89,7 @@ pub fn st_zmin_udf() -> SedonaScalarUDF { is_max: false, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("z", false)), + None, ) } @@ -103,7 +101,7 @@ pub fn st_zmax_udf() -> SedonaScalarUDF { is_max: true, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("z", true)), + None, ) } @@ -115,7 +113,7 @@ pub fn st_mmin_udf() -> SedonaScalarUDF { is_max: false, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("m", false)), + None, ) } @@ -127,27 +125,8 @@ pub fn st_mmax_udf() -> SedonaScalarUDF { is_max: true, })]), Volatility::Immutable, - Some(st_xyzm_minmax_doc("m", true)), - ) -} - -fn st_xyzm_minmax_doc(dim: &str, is_max: bool) -> Documentation { - let min_or_max = if is_max { "Max" } else { "Min" }; - let func_name = format!("ST_{}{}", dim.to_uppercase(), min_or_max); - Documentation::builder( - DOC_SECTION_OTHER, - format!( - "Return the {} of the {} dimension of the geometry", - min_or_max.to_lowercase(), - dim.to_uppercase() - ), - format!("{func_name} (A: Geometry)"), + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example(format!( - "SELECT {func_name}(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'))", - )) - .build() } #[derive(Debug)] @@ -240,35 +219,27 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_xmin_udf().into(); assert_eq!(udf.name(), "st_xmin"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_xmax_udf().into(); assert_eq!(udf.name(), "st_xmax"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_ymin_udf().into(); assert_eq!(udf.name(), "st_ymin"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_ymax_udf().into(); assert_eq!(udf.name(), "st_ymax"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_zmin_udf().into(); assert_eq!(udf.name(), "st_zmin"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_zmax_udf().into(); assert_eq!(udf.name(), "st_zmax"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_mmin_udf().into(); assert_eq!(udf.name(), "st_mmin"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = st_mmax_udf().into(); assert_eq!(udf.name(), "st_mmax"); - assert!(udf.documentation().is_some()) } #[rstest] diff --git a/rust/sedona-functions/src/st_zmflag.rs b/rust/sedona-functions/src/st_zmflag.rs index e84794397..488647d14 100644 --- a/rust/sedona-functions/src/st_zmflag.rs +++ b/rust/sedona-functions/src/st_zmflag.rs @@ -20,9 +20,7 @@ use crate::executor::WkbBytesExecutor; use arrow_array::builder::Int8Builder; use arrow_schema::DataType; use datafusion_common::{error::Result, DataFusionError}; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use geo_traits::Dimensions; use sedona_common::sedona_internal_err; use sedona_expr::{ @@ -37,19 +35,8 @@ pub fn st_zmflag_udf() -> SedonaScalarUDF { "st_zmflag", ItemCrsKernel::wrap_impl(vec![Arc::new(STZmFlag {})]), Volatility::Immutable, - Some(st_zmflag_doc()), - ) -} - -fn st_zmflag_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns a code indicating the ZM coordinate dimension of a geometry. Values are 0 for 2D, 1 for 3D-M, 2 for 3D-Z, and 3 for 4D.".to_string(), - "ST_ZmFlag (A: Geometry)".to_string(), + None, ) - .with_argument("geom", "geometry: Input geometry") - .with_sql_example("SELECT ST_ZmFlag(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'))") - .build() } #[derive(Debug)] @@ -130,7 +117,6 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = st_zmflag_udf().into(); assert_eq!(udf.name(), "st_zmflag"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_convexhull.rs b/rust/sedona-raster-functions/src/rs_convexhull.rs index d5ce4e2f6..14484f212 100644 --- a/rust/sedona-raster-functions/src/rs_convexhull.rs +++ b/rust/sedona-raster-functions/src/rs_convexhull.rs @@ -21,9 +21,7 @@ use arrow_array::builder::{BinaryBuilder, StringViewBuilder}; use datafusion_common::DataFusionError; use datafusion_common::Result; use datafusion_common::ScalarValue; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::item_crs::make_item_crs; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_geometry::wkb_factory::write_wkb_polygon; @@ -42,21 +40,10 @@ pub fn rs_convexhull_udf() -> SedonaScalarUDF { "rs_convexhull", vec![Arc::new(RsConvexHull {})], Volatility::Immutable, - Some(rs_convexhull_doc()), + None, ) } -fn rs_convexhull_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the convex hull geometry of the raster including the NoDataBandValue band pixels. For regular shaped and non-skewed rasters, this gives more or less the same result as RS_Envelope.".to_string(), - "RS_ConvexHull(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_ConvexHull(RS_Example())".to_string()) - .build() -} - #[derive(Debug)] struct RsConvexHull {} @@ -156,7 +143,6 @@ mod tests { fn udf_docs() { let udf: ScalarUDF = rs_convexhull_udf().into(); assert_eq!(udf.name(), "rs_convexhull"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_envelope.rs b/rust/sedona-raster-functions/src/rs_envelope.rs index 18e748ee0..5a6c4cc1a 100644 --- a/rust/sedona-raster-functions/src/rs_envelope.rs +++ b/rust/sedona-raster-functions/src/rs_envelope.rs @@ -21,9 +21,7 @@ use arrow_array::builder::{BinaryBuilder, StringViewBuilder}; use datafusion_common::DataFusionError; use datafusion_common::Result; use datafusion_common::ScalarValue; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::item_crs::make_item_crs; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_geometry::wkb_factory::write_wkb_polygon; @@ -40,21 +38,10 @@ pub fn rs_envelope_udf() -> SedonaScalarUDF { "rs_envelope", vec![Arc::new(RsEnvelope {})], Volatility::Immutable, - Some(rs_envelope_doc()), + None, ) } -fn rs_envelope_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the envelope of the raster as a Geometry.".to_string(), - "RS_Envelope(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_Envelope(RS_Example())".to_string()) - .build() -} - #[derive(Debug)] struct RsEnvelope {} @@ -166,7 +153,6 @@ mod tests { fn udf_docs() { let udf: ScalarUDF = rs_envelope_udf().into(); assert_eq!(udf.name(), "rs_envelope"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_example.rs b/rust/sedona-raster-functions/src/rs_example.rs index 98163b880..cf8266f35 100644 --- a/rust/sedona-raster-functions/src/rs_example.rs +++ b/rust/sedona-raster-functions/src/rs_example.rs @@ -18,9 +18,7 @@ use std::{sync::Arc, vec}; use crate::executor::RasterExecutor; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::builder::RasterBuilder; use sedona_raster::traits::BandMetadata; @@ -41,18 +39,8 @@ pub fn rs_example_udf() -> SedonaScalarUDF { "rs_example", vec![Arc::new(RsExample {})], Volatility::Immutable, - Some(rs_example_doc()), - ) -} - -fn rs_example_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return an example raster".to_string(), - "RS_Example()".to_string(), + None, ) - .with_sql_example("SELECT RS_Example()".to_string()) - .build() } #[derive(Debug)] @@ -120,7 +108,6 @@ mod tests { fn udf_size() { let udf: ScalarUDF = rs_example_udf().into(); assert_eq!(udf.name(), "rs_example"); - assert!(udf.documentation().is_some()); } #[test] diff --git a/rust/sedona-raster-functions/src/rs_geotransform.rs b/rust/sedona-raster-functions/src/rs_geotransform.rs index a94e95172..ac3b04ea1 100644 --- a/rust/sedona-raster-functions/src/rs_geotransform.rs +++ b/rust/sedona-raster-functions/src/rs_geotransform.rs @@ -20,9 +20,7 @@ use crate::executor::RasterExecutor; use arrow_array::builder::Float64Builder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::affine_transformation::rotation; use sedona_raster::traits::RasterRef; @@ -39,7 +37,7 @@ pub fn rs_upperleftx_udf() -> SedonaScalarUDF { param: GeoTransformParam::UpperLeftX, })], Volatility::Immutable, - Some(rs_upperleftx_doc()), + None, ) } @@ -54,7 +52,7 @@ pub fn rs_upperlefty_udf() -> SedonaScalarUDF { param: GeoTransformParam::UpperLeftY, })], Volatility::Immutable, - Some(rs_upperlefty_doc()), + None, ) } @@ -69,7 +67,7 @@ pub fn rs_scalex_udf() -> SedonaScalarUDF { param: GeoTransformParam::ScaleX, })], Volatility::Immutable, - Some(rs_scalex_doc()), + None, ) } @@ -84,7 +82,7 @@ pub fn rs_scaley_udf() -> SedonaScalarUDF { param: GeoTransformParam::ScaleY, })], Volatility::Immutable, - Some(rs_scaley_doc()), + None, ) } @@ -99,7 +97,7 @@ pub fn rs_skewx_udf() -> SedonaScalarUDF { param: GeoTransformParam::SkewX, })], Volatility::Immutable, - Some(rs_skewx_doc()), + None, ) } @@ -114,7 +112,7 @@ pub fn rs_skewy_udf() -> SedonaScalarUDF { param: GeoTransformParam::SkewY, })], Volatility::Immutable, - Some(rs_skewy_doc()), + None, ) } @@ -129,87 +127,10 @@ pub fn rs_rotation_udf() -> SedonaScalarUDF { param: GeoTransformParam::Rotation, })], Volatility::Immutable, - Some(rs_rotation_doc()), + None, ) } -fn rs_upperleftx_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the X coordinate of the upper-left corner of the raster.".to_string(), - "RS_UpperLeftX(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_UpperLeftX(RS_Example())".to_string()) - .build() -} - -fn rs_upperlefty_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the Y coordinate of the upper-left corner of the raster.".to_string(), - "RS_UpperLeftY(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_UpperLeftY(RS_Example())".to_string()) - .build() -} - -fn rs_scalex_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the pixel width of the raster in CRS units.".to_string(), - "RS_ScaleX(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_ScaleX(RS_Example())".to_string()) - .build() -} - -fn rs_scaley_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the pixel height of the raster in CRS units.".to_string(), - "RS_ScaleY(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_ScaleY(RS_Example())".to_string()) - .build() -} - -fn rs_skewx_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the X skew or rotation parameter.".to_string(), - "RS_SkewX(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_SkewX(RS_Example())".to_string()) - .build() -} - -fn rs_skewy_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the Y skew or rotation parameter.".to_string(), - "RS_SkewY(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_SkewY(RS_Example())".to_string()) - .build() -} - -fn rs_rotation_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the uniform rotation of the raster in radians.".to_string(), - "RS_Rotation(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_Rotation(RS_Example())".to_string()) - .build() -} - #[derive(Debug, Clone)] enum GeoTransformParam { Rotation, @@ -289,31 +210,24 @@ mod tests { fn udf_info() { let udf: ScalarUDF = rs_rotation_udf().into(); assert_eq!(udf.name(), "rs_rotation"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_scalex_udf().into(); assert_eq!(udf.name(), "rs_scalex"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_scaley_udf().into(); assert_eq!(udf.name(), "rs_scaley"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_skewx_udf().into(); assert_eq!(udf.name(), "rs_skewx"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_skewy_udf().into(); assert_eq!(udf.name(), "rs_skewy"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_upperleftx_udf().into(); assert_eq!(udf.name(), "rs_upperleftx"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_upperlefty_udf().into(); assert_eq!(udf.name(), "rs_upperlefty"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_rastercoordinate.rs b/rust/sedona-raster-functions/src/rs_rastercoordinate.rs index b7e74356c..5a28730aa 100644 --- a/rust/sedona-raster-functions/src/rs_rastercoordinate.rs +++ b/rust/sedona-raster-functions/src/rs_rastercoordinate.rs @@ -21,9 +21,7 @@ use arrow_array::builder::{BinaryBuilder, Int64Builder}; use arrow_schema::DataType; use datafusion_common::cast::as_float64_array; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::affine_transformation::to_raster_coordinate; use sedona_schema::datatypes::Edges; @@ -37,7 +35,7 @@ pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { "rs_worldtorastercoordy", vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], Volatility::Immutable, - Some(rs_worldtorastercoordy_doc()), + None, ) } @@ -49,7 +47,7 @@ pub fn rs_worldtorastercoordx_udf() -> SedonaScalarUDF { "rs_worldtorastercoordx", vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], Volatility::Immutable, - Some(rs_worldtorastercoordx_doc()), + None, ) } @@ -61,51 +59,10 @@ pub fn rs_worldtorastercoord_udf() -> SedonaScalarUDF { "rs_worldtorastercoord", vec![Arc::new(RsCoordinatePoint {})], Volatility::Immutable, - Some(rs_worldtorastercoord_doc()), + None, ) } -fn rs_worldtorastercoordx_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the X coordinate of the grid coordinate of the given world coordinates as an integer.".to_string(), - "RS_WorldToRasterCoord(raster: Raster, x: Float, y: Float)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Float: World x coordinate") - .with_argument("y", "Float: World y coordinate") - .with_sql_example("SELECT RS_WorldToRasterCoordX(RS_Example(), 34.865965, -111.812498)".to_string()) - .build() -} - -fn rs_worldtorastercoordy_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the Y coordinate of the grid coordinate of the given world coordinates as an integer.".to_string(), - "RS_WorldToRasterCoord(raster: Raster, x: Float, y: Float)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Float: World x coordinate") - .with_argument("y", "Float: World y coordinate") - .with_sql_example("SELECT RS_WorldToRasterCoordY(RS_Example(), 34.865965, -111.812498)".to_string()) - .build() -} - -fn rs_worldtorastercoord_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the grid coordinate of the given world coordinates as a Point.".to_string(), - "RS_WorldToRasterCoord(raster: Raster, x: Float, y: Float)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Float: World x coordinate") - .with_argument("y", "Float: World y coordinate") - .with_sql_example( - "SELECT RS_WorldToRasterCoord(RS_Example(), 34.865965, -111.812498)".to_string(), - ) - .build() -} - #[derive(Debug, Clone)] enum Coord { X, @@ -247,15 +204,12 @@ mod tests { fn udf_docs() { let udf: ScalarUDF = rs_worldtorastercoordy_udf().into(); assert_eq!(udf.name(), "rs_worldtorastercoordy"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_worldtorastercoordx_udf().into(); assert_eq!(udf.name(), "rs_worldtorastercoordx"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_worldtorastercoord_udf().into(); assert_eq!(udf.name(), "rs_worldtorastercoord"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_size.rs b/rust/sedona-raster-functions/src/rs_size.rs index b2dfa762d..71ee75ecb 100644 --- a/rust/sedona-raster-functions/src/rs_size.rs +++ b/rust/sedona-raster-functions/src/rs_size.rs @@ -20,9 +20,7 @@ use crate::executor::RasterExecutor; use arrow_array::builder::UInt64Builder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::traits::RasterRef; use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; @@ -37,7 +35,7 @@ pub fn rs_width_udf() -> SedonaScalarUDF { size_type: SizeType::Width, })], Volatility::Immutable, - Some(rs_width_doc()), + None, ) } @@ -51,32 +49,10 @@ pub fn rs_height_udf() -> SedonaScalarUDF { size_type: SizeType::Height, })], Volatility::Immutable, - Some(rs_height_doc()), + None, ) } -fn rs_width_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the width component of a raster".to_string(), - "RS_Width(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_Width(RS_Example())".to_string()) - .build() -} - -fn rs_height_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the height component of a raster".to_string(), - "RS_Height(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_Height(RS_Example())".to_string()) - .build() -} - #[derive(Debug, Clone)] enum SizeType { Width, @@ -142,11 +118,9 @@ mod tests { fn udf_size() { let udf: ScalarUDF = rs_width_udf().into(); assert_eq!(udf.name(), "rs_width"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_height_udf().into(); assert_eq!(udf.name(), "rs_height"); - assert!(udf.documentation().is_some()); } #[rstest] diff --git a/rust/sedona-raster-functions/src/rs_srid.rs b/rust/sedona-raster-functions/src/rs_srid.rs index 0e02ad6b9..b4046f40b 100644 --- a/rust/sedona-raster-functions/src/rs_srid.rs +++ b/rust/sedona-raster-functions/src/rs_srid.rs @@ -21,9 +21,7 @@ use arrow_array::builder::StringBuilder; use arrow_array::builder::UInt32Builder; use arrow_schema::DataType; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::traits::RasterRef; use sedona_schema::crs::CachedCrsToSRIDMapping; @@ -37,7 +35,7 @@ pub fn rs_srid_udf() -> SedonaScalarUDF { "rs_srid", vec![Arc::new(RsSrid {})], Volatility::Immutable, - Some(rs_srid_doc()), + None, ) } @@ -49,32 +47,10 @@ pub fn rs_crs_udf() -> SedonaScalarUDF { "rs_crs", vec![Arc::new(RsCrs {})], Volatility::Immutable, - Some(rs_crs_doc()), + None, ) } -fn rs_srid_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the spatial reference system identifier (SRID) of the raster".to_string(), - "RS_SRID(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_SRID(RS_Example())".to_string()) - .build() -} - -fn rs_crs_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Return the coordinate reference system (CRS) of the raster".to_string(), - "RS_CRS(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_sql_example("SELECT RS_CRS(RS_Example())".to_string()) - .build() -} - #[derive(Debug)] struct RsSrid {} @@ -171,11 +147,9 @@ mod tests { fn udf_metadata() { let udf: ScalarUDF = rs_srid_udf().into(); assert_eq!(udf.name(), "rs_srid"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_crs_udf().into(); assert_eq!(udf.name(), "rs_crs"); - assert!(udf.documentation().is_some()); } #[test] diff --git a/rust/sedona-raster-functions/src/rs_worldcoordinate.rs b/rust/sedona-raster-functions/src/rs_worldcoordinate.rs index 617e4fcd5..ba8b7825f 100644 --- a/rust/sedona-raster-functions/src/rs_worldcoordinate.rs +++ b/rust/sedona-raster-functions/src/rs_worldcoordinate.rs @@ -21,9 +21,7 @@ use arrow_array::builder::{BinaryBuilder, Float64Builder}; use arrow_schema::DataType; use datafusion_common::cast::as_int64_array; use datafusion_common::error::Result; -use datafusion_expr::{ - scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, -}; +use datafusion_expr::{ColumnarValue, Volatility}; use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; use sedona_raster::affine_transformation::to_world_coordinate; use sedona_schema::datatypes::Edges; @@ -37,7 +35,7 @@ pub fn rs_rastertoworldcoordy_udf() -> SedonaScalarUDF { "rs_rastertoworldcoordy", vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], Volatility::Immutable, - Some(rs_rastertoworldcoordy_doc()), + None, ) } @@ -49,7 +47,7 @@ pub fn rs_rastertoworldcoordx_udf() -> SedonaScalarUDF { "rs_rastertoworldcoordx", vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], Volatility::Immutable, - Some(rs_rastertoworldcoordx_doc()), + None, ) } @@ -61,49 +59,10 @@ pub fn rs_rastertoworldcoord_udf() -> SedonaScalarUDF { "rs_rastertoworldcoord", vec![Arc::new(RsCoordinatePoint {})], Volatility::Immutable, - Some(rs_rastertoworldcoord_doc()), + None, ) } -fn rs_rastertoworldcoordy_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the upper left Y coordinate of the given row and column of the given raster geometric units of the geo-referenced raster. If any out of bounds values are given, the Y coordinate of the assumed point considering existing raster pixel size and skew values will be returned.".to_string(), - "RS_RasterToWorldCoordY(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Integer: Column x into the raster") - .with_argument("y", "Integer: Row y into the raster") - .with_sql_example("SELECT RS_RasterToWorldCoordY(RS_Example(), 0, 0)".to_string()) - .build() -} - -fn rs_rastertoworldcoordx_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the upper left X coordinate of the given row and column of the given raster geometric units of the geo-referenced raster. If any out of bounds values are given, the X coordinate of the assumed point considering existing raster pixel size and skew values will be returned.".to_string(), - "RS_RasterToWorldCoordX(raster: Raster)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Integer: Column x into the raster") - .with_argument("y", "Integer: Row y into the raster") - .with_sql_example("SELECT RS_RasterToWorldCoordX(RS_Example(), 0, 0)".to_string()) - .build() -} - -fn rs_rastertoworldcoord_doc() -> Documentation { - Documentation::builder( - DOC_SECTION_OTHER, - "Returns the upper left X and Y coordinates of the given row and column of the given raster geometric units of the geo-referenced raster as a Point geometry. If any out of bounds values are given, the X and Y coordinates of the assumed point considering existing raster pixel size and skew values will be returned.".to_string(), - "RS_RasterToWorldCoord(raster: Raster, x: Integer, y: Integer)".to_string(), - ) - .with_argument("raster", "Raster: Input raster") - .with_argument("x", "Integer: Column x into the raster") - .with_argument("y", "Integer: Row y into the raster") - .with_sql_example("SELECT RS_RasterToWorldCoord(RS_Example(), 0, 0)".to_string()) - .build() -} - #[derive(Debug, Clone)] enum Coord { X, @@ -245,15 +204,12 @@ mod tests { fn udf_docs() { let udf: ScalarUDF = rs_rastertoworldcoordy_udf().into(); assert_eq!(udf.name(), "rs_rastertoworldcoordy"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_rastertoworldcoordx_udf().into(); assert_eq!(udf.name(), "rs_rastertoworldcoordx"); - assert!(udf.documentation().is_some()); let udf: ScalarUDF = rs_rastertoworldcoord_udf().into(); assert_eq!(udf.name(), "rs_rastertoworldcoord"); - assert!(udf.documentation().is_some()); } #[rstest]