Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/jni/duckdb_java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ jobject ProcessVector(JNIEnv *env, Connection *conn_ref, Vector &vec, idx_t row_
break;
}
case LogicalTypeId::BLOB:
case LogicalTypeId::GEOMETRY:
varlen_data = env->NewObjectArray(row_count, J_ByteArray, nullptr);

for (idx_t row_idx = 0; row_idx < row_count; row_idx++) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/duckdb/DuckDBColumnType.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ public enum DuckDBColumnType {
ARRAY,
UNKNOWN,
UNION,
VARIANT;
VARIANT,
GEOMETRY;
}
1 change: 1 addition & 0 deletions src/main/java/org/duckdb/DuckDBResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public String getString(int columnIndex) throws SQLException {
DuckDBColumnType sqlType = meta.column_types[columnIndex - 1];
switch (sqlType) {
case BLOB:
case GEOMETRY:
case LIST:
case STRUCT:
case MAP:
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/duckdb/DuckDBResultSetMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public static int type_to_int(DuckDBColumnType type) {
case BIT:
return Types.BIT;
case BLOB:
case GEOMETRY:
return Types.BLOB;
default:
return Types.OTHER;
Expand Down Expand Up @@ -356,6 +357,7 @@ public int getPrecision(int column) throws SQLException {
return 35;
case VARCHAR:
case BLOB:
case GEOMETRY:
return Integer.MAX_VALUE;
default:
return 0;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/duckdb/DuckDBVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Object getObject(int idx) throws SQLException {
case JSON:
return getJsonObject(idx);
case BLOB:
case GEOMETRY:
return getBlob(idx);
case UUID:
return getUuid(idx);
Expand Down Expand Up @@ -315,7 +316,7 @@ Blob getBlob(int idx) throws SQLException {
if (check_and_null(idx)) {
return null;
}
if (isType(DuckDBColumnType.BLOB)) {
if (isType(DuckDBColumnType.BLOB) || isType(DuckDBColumnType.GEOMETRY)) {
return new DuckDBResultSet.DuckDBBlobResult(ByteBuffer.wrap((byte[]) varlen_data[idx]));
}

Expand All @@ -327,7 +328,7 @@ byte[] getBytes(int idx) throws SQLException {
return null;
}

if (isType(DuckDBColumnType.BLOB)) {
if (isType(DuckDBColumnType.BLOB) || isType(DuckDBColumnType.GEOMETRY)) {
return (byte[]) varlen_data[idx];
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/duckdb/TestDuckDBJDBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -2246,9 +2246,9 @@ public static void main(String[] args) throws Exception {
statusCode = runTests(args, TestDuckDBJDBC.class, TestAppender.class, TestAppenderCollection.class,
TestAppenderCollection2D.class, TestAppenderComposite.class,
TestSingleValueAppender.class, TestBatch.class, TestBindings.class, TestClosure.class,
TestExtensionTypes.class, TestMetadata.class, TestNoLib.class,
/* TestSpatial.class, */ TestParameterMetadata.class, TestPrepare.class,
TestResults.class, TestSessionInit.class, TestTimestamp.class, TestVariant.class);
TestExtensionTypes.class, TestMetadata.class, TestNoLib.class, /* TestSpatial.class,*/
TestParameterMetadata.class, TestPrepare.class, TestResults.class,
TestSessionInit.class, TestTimestamp.class, TestVariant.class);
}
System.exit(statusCode);
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/org/duckdb/TestSpatial.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,8 @@ public static void test_spatial_GEOMETRY() throws Exception {
stmt.executeUpdate("INSTALL spatial");
stmt.executeUpdate("LOAD spatial");

byte[] geometryBytes =
new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
-51, -52, -52, -52, -52, -116, 68, 64, -102, -103, -103, -103, -103, 25, 69, 64};
byte[] geometryBytes = new byte[] {1, 1, 0, 0, 0, -51, -52, -52, -52, -52, -116,
68, 64, -102, -103, -103, -103, -103, 25, 69, 64};

// GEOMETRY literal
try (ResultSet rs = stmt.executeQuery("SELECT ST_GeomFromText('POINT(41.1 42.2)')")) {
Expand Down