Skip to content

Conversation

MariusVolkhart
Copy link
Contributor

The JDBC's ResultSet#getObject() method previously did not return Blob columns, though Blob support was already part of the ResultSet. The first commit adds support for Blob to getObject().

The ResultSet also didn't have support for UUID columns. These columns resulted in a "Unsupported result column type" exception. The second commit adds support for marshaling UUIDs from C++ to Java, modified ResultSet#getObject() to return java.util.UUID for those columns, and adds a public getUuid() method for retrieving the column without a cast. UUID columns are marshaled efficiently using byte representations, but VARCHAR columns can also be interpreted as UUIDs, matching behavior of other getType() style functions.

Teach the ResultSet#getObject(int) method to return Blob type.
Teach the ResultSet#getObject(int) method to return UUID type.
stmt.execute("CREATE TABLE t (id INT, b UUID)");
stmt.execute("INSERT INTO t VALUES (1, uuid())");
stmt.execute("CREATE TABLE t (id INT, b INTEGER[])");
stmt.execute("INSERT INTO t VALUES (1, [2, 3])");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to modify this test to a different column type since UUIDs no longer throw

@Mytherin Mytherin merged commit d34bcaf into duckdb:master Feb 16, 2023
@Mytherin
Copy link
Collaborator

Thanks for the PR! LGTM

@MariusVolkhart MariusVolkhart deleted the mv/blobAndUuid branch February 17, 2023 02:55
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.

2 participants