szehon-ho commented on code in PR #54114:
URL: https://github.com/apache/spark/pull/54114#discussion_r2796480666


##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/geo/Polygon.java:
##########
@@ -54,4 +54,23 @@ boolean isEmpty() {
   int getDimensionCount() {
     return 2 + (hasZ ? 1 : 0) + (hasM ? 1 : 0);
   }
+
+  @Override
+  protected void appendWktContent(StringBuilder sb) {
+    for (int i = 0; i < rings.size(); i++) {
+      if (i > 0) {
+        sb.append(",");
+      }
+      rings.get(i).appendCoordinatesToWkt(sb);
+    }
+  }
+
+  /**
+   * Appends the polygon coordinates wrapped in parentheses for use in 
MultiPolygon.
+   */
+  void appendCoordinatesToWkt(StringBuilder sb) {

Review Comment:
   this duplicate method in LineString.  Wdyt about having a generic base 
method in GeometryModel
   
   ```
   /**
    * Appends coordinates wrapped in parentheses for use in Multi* containers.
    */
   protected void appendMultiWktElement(StringBuilder sb) {
       sb.append("(");
       appendWktContent(sb);
       sb.append(")");
   }
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to