duckdb / duckdb/duckdb-java

Wrong WKB produced by jdbc driver when reading geometry type

Aperta
#486 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
127
Fork
80
Merge medio
13h 49m
PR unite (30g)
48

Descrizione

Try this:

```java
try (Statement s = connection.createStatement()) {
s.executeUpdate("install spatial");
s.executeUpdate("load spatial");

try (ResultSet rs = s.executeQuery("select cast('point (1 1)' as geometry)")) {
rs.next();
println(HexFormat.of().formatHex(rs.getBytes(1)));
}
}
```

This prints:

```
00000000000000000000000001000000000000000000f03f000000000000f03f
```

Which is an invalid WKB representation of `point(1 1)`. The correct representation is:

```
0101000000000000000000f03f000000000000f03f
```

This can be validated with this query:

```sql
select st_ashexwkb(cast ('POINT(1 1)' as geometry));
```

Or also with PostgreSQL:

```sql
select encode(st_asbinary(cast('point (1 1)' as geometry)), 'hex')`
```

I'm not sure if this is a duckdb_jdbc problem or a duckdb problem. Feel free to move the issue if it's not a JDBC problem.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Riproduci l'esempio Java JDBC nell'issue e confronta i byte restituiti con st_ashexwkb e con l'output di st_asbinary di PostgreSQL. Verifica se il WKB non valido viene prodotto dal driver JDBC o da DuckDB, quindi conferma che i byte della geometria restituiti corrispondano alla rappresentazione valida del punto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, sql
Ambito
database
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.