You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "Mayukh-D (via GitHub)" <gi...@apache.org> on 2026/10/23 21:08:16 UTC
[I] GeoPackage reader throws NullPointerException on a NULL geometry [sedona]
Mayukh-D opened a new issue, #3502:
URL: https://github.com/apache/sedona/issues/3502
### Expected behavior
A NULL in a geometry column of a GeoPackage feature table is read as a `null` geometry. NULL geometries are valid in GeoPackage, and GDAL reads such files without error.
### Actual behavior
The scan aborts as soon as an action reads the table (for example `count()`). `ValuesMapper` passes `rs.getBytes(column)` for every geometry column to `GeometryReader.extractWKB`, which calls `ByteBuffer.wrap` on it straight away. For a NULL cell the driver returns a null array:
```
java.lang.NullPointerException: Cannot read the array length because "array" is null
at java.base/java.nio.ByteBuffer.wrap(ByteBuffer.java:437)
at org.apache.sedona.sql.datasources.geopackage.transform.GeometryReader$.extractWKB(GeometryReader.scala:30)
at org.apache.sedona.sql.datasources.geopackage.transform.ValuesMapper$.$anonfun$mapValues$1(ValuesMapper.scala:61)
```
### Steps to reproduce
Read any GeoPackage feature table that has a row with a NULL geometry and call `count()`. Reported in discussion #3500, which links a public example file. Also reproduces on master.
### Sedona version
1.8.1
### Apache Spark version
4.0.0
### API type
Scala
### Scala version
2.13
### JRE version
21
### Environment
Local
### Existing issues
- [x] I searched the existing issues and did not find a duplicate.
--
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: issues-unsubscribe@sedona.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org