-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ResultSet.getBlob() calls when working with WKB_BLOB types #37
Comments
60 tasks
staticlibs
added a commit
to staticlibs/duckdb-java
that referenced
this issue
Mar 20, 2025
This change adds support for the following types from the spatial extension: - `POINT_2D`: as `STRUCT{x: DOUBLE, y: DOUBLE}` - `POINT_3D`: as `STRUCT{x: DOUBLE, y: DOUBLE, z: DOUBLE}` - `POINT_4D`: as `STRUCT{x: DOUBLE, y: DOUBLE, z: DOUBLE, m: DOUBLE}` - `LINESTRING_2D`: as `LIST[STRUCT{x: DOUBLE, y: DOUBLE}]` - `POLYGON_2D`: as `LIST[LIST[STRUCT{x: DOUBLE, y: DOUBLE}]]` - `BOX_2D`: as `STRUCT{min_x: DOUBLE, max_x: DOUBLE, min_y: DOUBLE, max_y: DOUBLE}` - `BOX_2DF`: as `STRUCT{min_x: FLOAT, max_x: FLOAT, min_y: FLOAT, max_y: FLOAT}` - `GEOMETRY`: as `BLOB` - `WKB_BLOB`: as `BLOB` No new Java APIs are added for these types. Instead `java.sql.Array`, `java.sql.Struct` and `java.sql.Blob` need to be used to read them from a result set or to pass them as bind parameters. Testing: new test added to cover all spatial types in bind parameters and in result set. Fixes: duckdb#37
This was referenced Mar 20, 2025
staticlibs
added a commit
to staticlibs/duckdb-java
that referenced
this issue
Mar 20, 2025
This change adds support for the following types from the spatial extension: - `POINT_2D`: as `STRUCT{x: DOUBLE, y: DOUBLE}` - `POINT_3D`: as `STRUCT{x: DOUBLE, y: DOUBLE, z: DOUBLE}` - `POINT_4D`: as `STRUCT{x: DOUBLE, y: DOUBLE, z: DOUBLE, m: DOUBLE}` - `LINESTRING_2D`: as `LIST[STRUCT{x: DOUBLE, y: DOUBLE}]` - `POLYGON_2D`: as `LIST[LIST[STRUCT{x: DOUBLE, y: DOUBLE}]]` - `BOX_2D`: as `STRUCT{min_x: DOUBLE, max_x: DOUBLE, min_y: DOUBLE, max_y: DOUBLE}` - `BOX_2DF`: as `STRUCT{min_x: FLOAT, max_x: FLOAT, min_y: FLOAT, max_y: FLOAT}` - `GEOMETRY`: as `BLOB` - `WKB_BLOB`: as `BLOB` No new Java APIs are added for these types. Instead `java.sql.Array`, `java.sql.Struct` and `java.sql.Blob` need to be used to read them from a result set or to pass them as bind parameters. Testing: new test added to cover all spatial types in bind parameters and in result set. Fixes: duckdb#37
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this program:
It errors as follows:
This is because the
WKB_BLOB
type isn't supported byorg.duckdb.DuckDBColumnType
, and thusorg.duckdb.DuckDBResultSetMetaData.TypeNameToType(String)
can't look up the type name.A workaround is to cast as ordinary
BLOB
or use a different function, such asst_ashexwkb
:This prints:
According to the docs:
https://duckdb.org/docs/extensions/spatial
This topic isn't documented very thoroughly, but I think it's reasonable to read between the lines that
WKB_BLOB
is safe to be treated as an ordinaryBLOB
when reading the value.The text was updated successfully, but these errors were encountered: