szehon-ho commented on code in PR #54424:
URL: https://github.com/apache/spark/pull/54424#discussion_r2843858336
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/Geography.java:
##########
@@ -81,13 +82,17 @@ public Geography copy() {
// Returns a Geography object with the specified SRID value by parsing the
input WKB.
public static Geography fromWkb(byte[] wkb, int srid) {
- WkbReader reader = new WkbReader(true);
- reader.read(wkb); // Validate WKB with geography coordinate bounds.
+ try {
+ WkbReader reader = new WkbReader(true);
+ reader.read(wkb); // Validate WKB with geography coordinate bounds.
- byte[] bytes = new byte[HEADER_SIZE + wkb.length];
- ByteBuffer.wrap(bytes).order(DEFAULT_ENDIANNESS).putInt(srid);
- System.arraycopy(wkb, 0, bytes, WKB_OFFSET, wkb.length);
- return fromBytes(bytes);
+ byte[] bytes = new byte[HEADER_SIZE + wkb.length];
+ ByteBuffer.wrap(bytes).order(DEFAULT_ENDIANNESS).putInt(srid);
+ System.arraycopy(wkb, 0, bytes, WKB_OFFSET, wkb.length);
+ return fromBytes(bytes);
+ } catch (WkbParseException e) {
Review Comment:
curious, we do not keep the wkb string as hex, it is by design? I find it
useful for debugging, but curious
--
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]