Copilot commented on code in PR #416: URL: https://github.com/apache/sedona-db/pull/416#discussion_r2594001779
########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate +pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordy", + vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], + Volatility::Immutable, + Some(rs_worldtorastercoordy_doc()), + ) +} + +/// RS_WorldToRasterCoordX() scalar UDF documentation +/// +/// Converts pixel coordinates to world X coordinate +pub fn rs_worldtorastercoordx_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordx", + vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], + Volatility::Immutable, + Some(rs_worldtorastercoordx_doc()), + ) +} + +/// RS_WorldToRasterCoord() scalar UDF documentation +/// +/// Converts pixel coordinates to world coordinate Point +pub fn rs_worldtorastercoord_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoord", + vec![Arc::new(RsCoordinatePoint {})], + Volatility::Immutable, + Some(rs_worldtorastercoord_doc()), + ) +} + +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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: 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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: World y coordinate") Review Comment: The argument type 'Geometry' is incorrect for numeric coordinate parameters. These should be documented as 'Float' to match the actual parameter types. ########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate Review Comment: The documentation comment incorrectly states 'Converts pixel coordinates to world Y coordinate' when the function actually converts world coordinates to raster pixel Y coordinate. Update to 'Converts world coordinates to raster pixel Y coordinate'. ```suggestion /// Converts world coordinates to raster pixel Y coordinate ``` ########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate +pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordy", + vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], + Volatility::Immutable, + Some(rs_worldtorastercoordy_doc()), + ) +} + +/// RS_WorldToRasterCoordX() scalar UDF documentation +/// +/// Converts pixel coordinates to world X coordinate +pub fn rs_worldtorastercoordx_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordx", + vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], + Volatility::Immutable, + Some(rs_worldtorastercoordx_doc()), + ) +} + +/// RS_WorldToRasterCoord() scalar UDF documentation +/// +/// Converts pixel coordinates to world coordinate Point Review Comment: The documentation comment incorrectly states 'Converts pixel coordinates to world coordinate Point' when the function actually converts world coordinates to raster pixel coordinate Point. Update to 'Converts world coordinates to raster pixel coordinate Point'. ```suggestion /// Converts world coordinates to raster pixel coordinate Point ``` ########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate +pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordy", + vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], + Volatility::Immutable, + Some(rs_worldtorastercoordy_doc()), + ) +} + +/// RS_WorldToRasterCoordX() scalar UDF documentation +/// +/// Converts pixel coordinates to world X coordinate +pub fn rs_worldtorastercoordx_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordx", + vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], + Volatility::Immutable, + Some(rs_worldtorastercoordx_doc()), + ) +} + +/// RS_WorldToRasterCoord() scalar UDF documentation +/// +/// Converts pixel coordinates to world coordinate Point +pub fn rs_worldtorastercoord_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoord", + vec![Arc::new(RsCoordinatePoint {})], + Volatility::Immutable, + Some(rs_worldtorastercoord_doc()), + ) +} + +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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: 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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: 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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: World y coordinate") Review Comment: The argument type 'Geometry' is incorrect for numeric coordinate parameters. These should be documented as 'Float' to match the actual parameter types. ########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate +pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordy", + vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], + Volatility::Immutable, + Some(rs_worldtorastercoordy_doc()), + ) +} + +/// RS_WorldToRasterCoordX() scalar UDF documentation +/// +/// Converts pixel coordinates to world X coordinate +pub fn rs_worldtorastercoordx_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordx", + vec![Arc::new(RsCoordinateMapper { coord: Coord::X })], + Volatility::Immutable, + Some(rs_worldtorastercoordx_doc()), + ) +} + +/// RS_WorldToRasterCoord() scalar UDF documentation +/// +/// Converts pixel coordinates to world coordinate Point +pub fn rs_worldtorastercoord_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoord", + vec![Arc::new(RsCoordinatePoint {})], + Volatility::Immutable, + Some(rs_worldtorastercoord_doc()), + ) +} + +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", "Geometry: World x coordinate") + .with_argument("y", "Geometry: World y coordinate") Review Comment: The argument type 'Geometry' is incorrect for numeric coordinate parameters. These should be documented as 'Float' to match the actual parameter types. ########## rust/sedona-raster-functions/src/rs_rastercoordinate.rs: ########## @@ -0,0 +1,333 @@ +// 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. +use std::{sync::Arc, vec}; + +use crate::executor::RasterExecutor; +use arrow_array::builder::{BinaryBuilder, Int64Builder}; +use arrow_schema::DataType; +use datafusion_common::ScalarValue; +use datafusion_common::{error::Result, exec_err}; +use datafusion_expr::{ + scalar_doc_sections::DOC_SECTION_OTHER, ColumnarValue, Documentation, Volatility, +}; +use sedona_expr::scalar_udf::{SedonaScalarKernel, SedonaScalarUDF}; +use sedona_raster::affine_transformation::to_raster_coordinate; +use sedona_schema::datatypes::Edges; +use sedona_schema::{datatypes::SedonaType, matchers::ArgMatcher}; + +/// RS_WorldToRasterCoordY() scalar UDF documentation +/// +/// Converts pixel coordinates to world Y coordinate +pub fn rs_worldtorastercoordy_udf() -> SedonaScalarUDF { + SedonaScalarUDF::new( + "rs_worldtorastercoordy", + vec![Arc::new(RsCoordinateMapper { coord: Coord::Y })], + Volatility::Immutable, + Some(rs_worldtorastercoordy_doc()), + ) +} + +/// RS_WorldToRasterCoordX() scalar UDF documentation +/// +/// Converts pixel coordinates to world X coordinate Review Comment: The documentation comment incorrectly states 'Converts pixel coordinates to world X coordinate' when the function actually converts world coordinates to raster pixel X coordinate. Update to 'Converts world coordinates to raster pixel X coordinate'. ```suggestion /// Converts world coordinates to raster pixel X coordinate ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
