prestodb/presto · error · SQLFeatureNotSupportedException

createArrayOf

Error message

createArrayOf

What it means

PrestoConnection.createArrayOf(String typeName, Object[] elements) unconditionally throws SQLFeatureNotSupportedException("createArrayOf"). The driver does not implement client-side java.sql.Array creation; the stub fails before any request. ARRAY parameters must be passed as native Java arrays/collections instead.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java:581

        return clientInfo.get(name);
    }

    @Override
    public Properties getClientInfo()
            throws SQLException
    {
        Properties properties = new Properties();
        for (Map.Entry<String, String> entry : clientInfo.entrySet()) {
            properties.setProperty(entry.getKey(), entry.getValue());
        }
        return properties;
    }

    @Override
    public Array createArrayOf(String typeName, Object[] elements)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createArrayOf");
    }

    @Override
    public Struct createStruct(String typeName, Object[] attributes)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createStruct");
    }

    @Override
    public void setSchema(String schema)
            throws SQLException
    {
        checkOpen();
        this.schema.set(schema);
    }

    @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Pass the array directly via ps.setObject(1, elements) — the driver maps Java arrays/collections to Presto ARRAY types
  2. Build ARRAY literals in SQL text with an explicit CAST when precise element typing is needed
  3. Catch SQLFeatureNotSupportedException and switch to the setObject path

Example fix

// before
Array arr = connection.createArrayOf("bigint", new Long[]{1L, 2L});
ps.setArray(1, arr);
// after
ps.setObject(1, new Long[]{1L, 2L});
Defensive patterns

Strategy: try-catch

Validate before calling

DatabaseMetaData meta = connection.getMetaData();
if (meta.getDriverName().contains("Presto")) {
    // bind arrays via setObject, not createArrayOf
}

Type guard

static boolean supportsCreateArray(DatabaseMetaData meta) throws SQLException {
    return !meta.getDriverName().contains("Presto");
}

Try / catch

try {
    Array arr = connection.createArrayOf("bigint", elements);
    ps.setArray(1, arr);
} catch (SQLFeatureNotSupportedException e) {
    ps.setObject(1, elements); // driver maps arrays/collections to ARRAY
}

Prevention

When it happens

Trigger: Calling connection.createArrayOf("bigint", elements) and then PreparedStatement.setArray with the result.

Common situations: Generic data pipelines binding Presto ARRAY columns; migrations from drivers (Postgres) where createArrayOf is the standard way to bind arrays.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/a718b2dcca2c8b9b. Report an issue: GitHub.