minhpham1810 opened a new pull request, #3292:
URL: https://github.com/apache/sedona/pull/3292

   ## Did you read the Contributor Guide?
   
   - Yes, I have read the [Contributor 
Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor 
Development Guide](https://sedona.apache.org/latest/community/develop/)
   
   ## Is this PR related to a ticket?
   
   - Yes, and the PR name follows the format `[GH-XXX] my subject`.
   
   Closes #3174.
   
   ## What changes were proposed in this PR?
   
   - Reworked `isPolygonCW`/`isPolygonCCW` in `common/Functions.java` to 
recursively inspect polygonal components (`Polygon`, `MultiPolygon`, and nested 
`GeometryCollection` at any depth) and vacuously return `true` for inputs with 
no polygonal components (points, line strings, empty geometry collections), 
matching PostGIS semantics. Both predicates share one recursive helper 
(`allPolygonalComponentsMatchOrientation`) to avoid duplicating the traversal 
logic.
   - Changed the Flink `ST_IsPolygonCW`/`ST_IsPolygonCCW` wrappers from 
primitive `boolean` to nullable `Boolean` with an explicit null check, so a SQL 
`NULL` input now returns `NULL` instead of `false`.
   - Updated documentation for `ST_IsPolygonCW`/`ST_IsPolygonCCW` across the 
SQL, Flink, and Snowflake docs, and added a breaking-change entry to the Sedona 
2.0.0 release notes.
   - Added test coverage for non-polygonal geometries, nested 
`GEOMETRYCOLLECTION` recursion, and `NULL` propagation across the common, Spark 
SQL, Flink, and Snowflake test suites.
   
   No code changes were needed in the Snowflake or Spark UDF wrappers: 
Snowflake's Java UDF runtime already short-circuits `NULL` input before 
invoking the handler, and Spark's `InferredExpression` already short-circuits 
`NULL` geometry arguments before calling the underlying common function.
   
   Since `master` is already `2.0.0-SNAPSHOT`, this breaking change lands 
directly at the major-version boundary called out in the issue, without needing 
a compatibility flag.
   
   ## How was this patch tested?
   
   - `mvn -pl common -Dtest=FunctionsTest test` (328 tests, including new 
coverage for nested `GeometryCollection` recursion and mixed orientation)
   - `mvn -pl flink 
-Dtest=FunctionTest#testIsPolygonCW,testIsPolygonCCW,testIsPolygonOrientationForEmptyGeometries,testIsPolygonOrientationForNonPolygonalAndCollectionGeometries,testIsPolygonOrientationNullPropagation
 test`
   - `mvn -Dsnowflake=true -pl snowflake-tester -am -DskipTests package` 
(compiles cleanly; tests require live Snowflake credentials so were not 
executed)
   - Spark: added coverage to `functionTestScala.scala`. Could not get a full 
`spark/common` reactor build in the local dev environment due to a 
pre-existing, unrelated `protobuf-java`/generated-sources mismatch in the OSM 
PBF datasource reader (`package proto4 does not exist`); no code outside the 
added Scala test was touched in the Spark module, and the fix relies on 
`InferredExpression`'s existing null-short-circuiting, which is exercised by 
many other predicates in this codebase.
   
   ## Did this PR include necessary documentation updates?
   
   - Yes, I have updated the documentation.


-- 
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]

Reply via email to