szehon-ho commented on code in PR #54114:
URL: https://github.com/apache/spark/pull/54114#discussion_r2790611355
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/geo/GeometryModel.java:
##########
@@ -176,4 +176,50 @@ GeometryCollection asGeometryCollection() {
throw new ClassCastException(
"Cannot cast " + getClass().getSimpleName() + " to GeometryCollection");
}
+
+ /**
+ * Appends dimension suffix (Z, M, or ZM) to the WKT type name.
+ */
+ protected void appendDimensionSuffix(StringBuilder sb) {
+ if (hasZ && hasM) {
+ sb.append(" ZM");
+ } else if (hasZ) {
+ sb.append(" Z");
+ } else if (hasM) {
+ sb.append(" M");
+ }
+ }
+
+ /**
+ * Appends the WKT (Well-Known Text) representation of this geometry to the
given StringBuilder.
+ */
+ protected void toWkt(StringBuilder sb) {
+ sb.append(typeId.getWktName());
+ appendDimensionSuffix(sb);
+ if (isEmpty()) {
+ sb.append(" EMPTY");
+ } else {
+ if (hasZ || hasM) {
Review Comment:
this is a bit hard to read, can we put some examples in javadoc?
For example:
POINT(1 2)
POINT Z (1 2 3)
POINT M (1 2 3)
POINT ZM (1 2 3 4)
POINT EMPTY
POINT Z EMPTY
--
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]