uros-db commented on code in PR #54325:
URL: https://github.com/apache/spark/pull/54325#discussion_r2836274842
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/Geography.java:
##########
@@ -154,14 +155,20 @@ public byte[] toEwkb(ByteOrder endianness) {
@Override
public byte[] toWkt() {
- // Once WKT conversion is implemented, it should support various
precisions.
- throw new UnsupportedOperationException("Geography WKT conversion is not
yet supported.");
+ return toWktInternal().getBytes(StandardCharsets.UTF_8);
}
@Override
public byte[] toEwkt() {
- // Once EWKT conversion is implemented, it should support various
precisions.
- throw new UnsupportedOperationException("Geography EWKT conversion is not
yet supported.");
+ String ewkt = "SRID=" + srid() + ";" + toWktInternal();
+ return ewkt.getBytes(StandardCharsets.UTF_8);
+ }
+
+ private String toWktInternal() {
+ WkbReader reader = new WkbReader(true);
+ GeometryModel model = reader.read(Arrays.copyOfRange(
+ getBytes(), WKB_OFFSET, getBytes().length));
+ return model.toString();
Review Comment:
Good point, thanks for bringing this up! But yeah since it doesn't have to
do with Thrift support, let's do it separately here:
https://github.com/apache/spark/pull/54414. I'm adding you to review.
--
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]