Skip to content

Add UUID support to DuckDBAppender (fixes #313)#324

Merged
staticlibs merged 2 commits intoduckdb:mainfrom
arouel:append-uuid-support
Jul 30, 2025
Merged

Add UUID support to DuckDBAppender (fixes #313)#324
staticlibs merged 2 commits intoduckdb:mainfrom
arouel:append-uuid-support

Conversation

@arouel
Copy link
Contributor

@arouel arouel commented Jul 28, 2025

Previously, attempting to append a UUID would result in an unsupported C API type: 27 error which is documented in #313. This change enables the DuckDBAppender to handle java.util.UUID objects directly.

Add UUID support to `DuckDBAppender` (fixes 313)
@staticlibs
Copy link
Collaborator

Hi, thanks for the PR, it looks good to me! To fix the formatting:

python -m pip install --user clang_format==11.0.1
make format
make format-check

@arouel
Copy link
Contributor Author

arouel commented Jul 29, 2025

@staticlibs thank you for the quick feedback. I refined the formatting.

One quick question: I stumbled upon the appenderRefLock in the new DuckDBAppender and asked myself for what we need a Lock, because a DuckDBAppender cannot be used by multiple threads anyways?

@staticlibs staticlibs merged commit 1920c7f into duckdb:main Jul 30, 2025
9 checks passed
@staticlibs
Copy link
Collaborator

@arouel

for what we need a Lock, because a DuckDBAppender cannot be used by multiple threads anyways

The Appender is not intended to append the data concurrently, but it can be closed concurrently. For example, if the Appenders's connection is closed, the Appender is closed automatically. This connection close can well be triggered concurrently, for example from the shutdown cleanup code. After the Appender is closed - its native part is destroyed. And the destruction of the native part cannot be concurrent with it usage from other thread. Almost all append() methods (with the notable exception of strings over 12 bytes long) are Java-local - they only lay the input data out into the Data Chunk (thus they should be fast). But flush() operation calls to the native part and cannot be concurrent with close(). So the appenderRefLock is used to put them in order.

@arouel
Copy link
Contributor Author

arouel commented Jul 30, 2025

Thank you for the thorough response.

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.

3 participants