You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "szehon-ho (via GitHub)" <gi...@apache.org> on 2026/02/24 00:56:34 UTC
Re: [PR] [SPARK-55640][Geo][SQL] Propagate WKB parsing errors for Geometry and Geography [spark]
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org