jiayuasu opened a new pull request, #1186: URL: https://github.com/apache/sedona/pull/1186
## Did you read the Contributor Guide? - Yes, I have read [Contributor Rules](https://sedona.apache.org/latest-snapshot/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest-snapshot/community/develop/) ## Is this PR related to a JIRA ticket? - Yes, the URL of the associated JIRA ticket is https://issues.apache.org/jira/browse/SEDONA-459. The PR name follows the format `[SEDONA-XXX] my subject`. ## What changes were proposed in this PR? Added UDFsV2 which overload all ST functions with native Snowflake Geometry type. Now SedonaSnow functions can directly interact with Snowflake native ST functions. Users can mix-match Sedona / Snowflake ST functions together in the same SQL query. Example: ``` SELECT ST_AsText(SEDONA.ST_ReducePrecision(ST_GeometryFromWKT('POINT(1.123456789 2.123456789)'), 3)) ``` In this example, `SEDONA.ST_ReducePrecision` is the Sedona UDF, ST_AsText and ST_GeometryFromWKT are Snowflake native functions. However, due to the limitation imposed by Snowflakes, the following functions cannot directly interact with Snowflake native functions because they cannot be overloaded or supported. However, **Users still can use Snowflake `ST_AsWKB` and `to_geometry` to interact with these Sedona functions.** ### Functions that cannot be overloaded by Snowflake Any ST functions that only use primitive types as input excluding `Geometry` type. All ST constructors cannot be overloaded. For example, `ST_GeomFromWKT`, `ST_Point`. ### Functions that have incorrect behavior Snowflake natively serializes Geometry type data to GeoJSON String and sends to UDF as input. GeoJSON spec does not include SRID. So the SRID information will be lost if you mix-match Snowflake functions and Sedona functions directly without using `WKB`. Example: ``` SELECT ST_AsEWKT(SEDONA.ST_SetSRID(ST_GeometryFromWKT('POINT(1 2)'), 4326)) ``` Output: `SRID=0;POINT(1 2)` `SRID=4326` is lost. ### Functions that are not supported by Snowflake All User Defined Table Functions are not supported due to Snowflake current limitation `Data type GEOMETRY is not supported in non-SQL UDTF return type`. This includes * ST_MinimumBoundingRadius * ST_Intersection_Aggr * ST_SubDivideExplode * ST_Envelope_Aggr * ST_Union_Aggr * ST_Collect * ST_Dump ## How was this patch tested? ## Did this PR include necessary documentation updates? Docs will be added in PR 4/4 -- 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: dev-unsubscr...@sedona.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org