uros-db commented on code in PR #54227:
URL: https://github.com/apache/spark/pull/54227#discussion_r2797027368
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/geo/WkbReader.java:
##########
@@ -25,29 +25,61 @@
import java.util.List;
/**
- * Reader for parsing Well-Known Binary (WKB) format geometries.
+ * Reader for parsing Well-Known Binary (WKB) format geometries and
geographies.
* This class implements the OGC Simple Features specification for WKB parsing.
+ * For geographies, coordinate bounds validation is enforced:
+ * - X (longitude) must be between -180 and 180 (inclusive),
+ * - Y (latitude) must be between -90 and 90 (inclusive).
* This class is not thread-safe. Create a new instance for each thread.
* This class should be catalyst-internal.
*/
public class WkbReader {
private ByteBuffer buffer;
private final int validationLevel;
+ private final boolean geographyMode;
private byte[] currentWkb;
+ // Geography coordinate bounds.
+ private static final double MIN_LONGITUDE = -180.0;
+ private static final double MAX_LONGITUDE = 180.0;
+ private static final double MIN_LATITUDE = -90.0;
+ private static final double MAX_LATITUDE = 90.0;
+ // Default WKB reader settings.
+ private static final int DEFAULT_VALIDATION_LEVEL = 1; // basic validation
+ private static final boolean DEFAULT_GEOGRAPHY_MODE = false; // no geography
bounds checking
Review Comment:
Agreed, this makes sense. I applied the changes according to your suggestion.
--
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]