Skip to content

Use native string cast for ext composite types #320

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

staticlibs
Copy link
Collaborator

This change adjusts the ResultSet#getString() behaviour for columns with composite types like STRUCT or LIST and also for extension types. This method now delegates the cast to the native cast to VARCHAR. When the extension (e.g. spatial) registers a cast for its own types to VARCHAR - this cast now will be triggered.

In many cases, like MAPs, the resulting representation is the same. But in some cases, like spatial's GEOMETRY the resulting string now can be correctly deserialized into its textual representation:

POINT (41.1 42.2)

instead of opaque (and useless one):

DuckDBBlobResult{buffer=java.nio.HeapByteBuffer[pos=0 lim=32 cap=32]}

Fixes: #298

This change adjusts the `ResultSet#getString()` behaviour for columns
with composite types like `STRUCT` or `LIST` and also for extension
types. This method now delegates the cast to the native cast to
`VARCHAR`. When the extension (e.g. `spatial`) registers a cast for its
own types to `VARCHAR` - this cast now will be triggered.

In many cases, like `MAP`s, the resulting representation is the same.
But in some cases, like `spatial`'s `GEOMETRY` the resulting string now
can be correctly deserialized into its textual representation:

```
POINT (41.1 42.2)
```

instead of opaque (and useless one):

```
DuckDBBlobResult{buffer=java.nio.HeapByteBuffer[pos=0 lim=32 cap=32]}
```

Fixes: duckdb#298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DuckDB-1.3.1.0] Geometry Functions return now DuckDBBlobResult instead of Text
1 participant