Skip to content

Cannot select DECIMAL lists via JDBC #9482

@michaeljohnalbers

Description

@michaeljohnalbers

What happens?

When trying to run SELECT statements via JDBC where one of the selected columns is of DECIMAL[] type, the query fails throwing an exception.

To Reproduce

    public static void main(String[] args) throws SQLException{
        Connection c = DriverManager.getConnection("jdbc:duckdb:");
        try (Statement s = c.createStatement()) {
            s.execute("CREATE TABLE T1(a0 DECIMAL[])");
            s.executeQuery("SELECT * from T1");
        }
    }

Exception

Exception in thread "main" java.lang.NumberFormatException: For input string: "(18,3)[]"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:654)
	at java.base/java.lang.Short.parseShort(Short.java:137)
	at java.base/java.lang.Short.parseShort(Short.java:163)
	at org.duckdb.DuckDBColumnTypeMetaData.parseColumnTypeMetadata(DuckDBColumnTypeMetaData.java:16)
	at org.duckdb.DuckDBResultSetMetaData.<init>(DuckDBResultSetMetaData.java:38)
	at org.duckdb.DuckDBNative.duckdb_jdbc_prepared_statement_meta(Native Method)
	at org.duckdb.DuckDBPreparedStatement.prepare(DuckDBPreparedStatement.java:107)
	at org.duckdb.DuckDBPreparedStatement.executeQuery(DuckDBPreparedStatement.java:189)
	at com.modeanalytics.nugget.arrow.FlightSqlServerTest.main(FlightSqlServerTest.java:184)

OS:

MacOS Ventura 13.6

DuckDB Version:

0.9.1

DuckDB Client:

JDBC

Full Name:

Michael Albers

Affiliation:

ThoughtSpot

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions