{"record":{"id":"9f309eca3f7f56d1","repo":"prestodb/presto","slug":"setarray","errorCode":null,"errorMessage":"setArray","messagePattern":"setArray","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":510,"sourceCode":"    @Override\n    public void setBlob(int parameterIndex, Blob x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setBlob\");\n    }\n\n    @Override\n    public void setClob(int parameterIndex, Clob x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setClob\");\n    }\n\n    @Override\n    public void setArray(int parameterIndex, Array x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setArray\");\n    }\n\n    @Override\n    public ResultSetMetaData getMetaData()\n            throws SQLException\n    {\n        try (Statement statement = connection().createStatement(); ResultSet resultSet = statement.executeQuery(\"DESCRIBE OUTPUT \" + statementName)) {\n            return new PrestoResultSetMetaData(getDescribeOutputColumnInfoList(resultSet));\n        }\n    }\n\n    @Override\n    public void setDate(int parameterIndex, Date x, Calendar cal)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setDate\");\n    }\n","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L492-L528","documentation":"setArray is unconditionally unsupported in PrestoPreparedStatement: any call throws SQLFeatureNotSupportedException because java.sql.Array handles are not implemented. Array-typed parameters must be expressed differently (e.g. as literal text) in this driver.","triggerScenarios":"Calling PreparedStatement.setArray(int, Array) on a Presto connection.","commonSituations":"Trying to insert into Presto ARRAY columns using JDBC Array objects created from another connection or connection.createArrayOf.","solutions":["Serialize the collection to a JSON string (e.g. Jackson) and cast in SQL: CAST(? AS ARRAY<type>).","Bind each array element as separate scalar parameters if the size is fixed.","Use connection.createArrayOf if supported by your driver version, else avoid Array objects."],"exampleFix":"// before\nps.setArray(1, conn.createArrayOf(\"int\", ints));\n// after\nString json = new ObjectMapper().writeValueAsString(ints);\nps.setString(1, json); // CAST(? AS ARRAY<BIGINT>) in SQL","handlingStrategy":"fallback","validationCode":"if (x instanceof java.sql.Array) { throw new IllegalArgumentException(\"pass array as JSON string with CAST in SQL instead\"); }","typeGuard":null,"tryCatchPattern":"try { ps.setArray(1, arr); } catch (SQLFeatureNotSupportedException e) { ps.setString(1, toJson(list)); /* CAST(? AS ARRAY<T>) */ }","preventionTips":["Bind Presto ARRAY columns via JSON string + CAST(? AS ARRAY<type>)","Expand fixed-size arrays into individual scalar parameters","Avoid java.sql.Array with Presto JDBC"],"tags":["jdbc","presto","unsupported-feature"],"backgroundTag":"jdbc-feature-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}