prestodb/presto · error · NotImplementedException

Not implemented: PreparedStatement.setDate

Error message

Not implemented: PreparedStatement.setDate

What it means

setDate(int, Date, Calendar) — the Calendar-aware variant used for timezone-adjusted DATE binding — is not implemented in the Presto JDBC driver and throws NotImplementedException. The two-argument setDate is supported; only the Calendar overload is not.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java:526

            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setArray");
    }

    @Override
    public ResultSetMetaData getMetaData()
            throws SQLException
    {
        try (Statement statement = connection().createStatement(); ResultSet resultSet = statement.executeQuery("DESCRIBE OUTPUT " + statementName)) {
            return new PrestoResultSetMetaData(getDescribeOutputColumnInfoList(resultSet));
        }
    }

    @Override
    public void setDate(int parameterIndex, Date x, Calendar cal)
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "setDate");
    }

    @Override
    public void setTime(int parameterIndex, Time x, Calendar cal)
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "setTime");
    }

    @Override
    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "setTimestamp");
    }

    @Override
    public void setNull(int parameterIndex, int sqlType, String typeName)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use the two-argument setDate(parameterIndex, Date) instead.
  2. Set the JVM/session timezone (user=... connection property) so the default conversion matches your need.
  3. Pre-convert the java.util.Date to the desired zone with a Calendar yourself, then bind with plain setDate.

Example fix

// before
ps.setDate(1, sqlDate, cal);
// after
ps.setDate(1, new java.sql.Date(sqlDate.getTime()));
Defensive patterns

Strategy: fallback

Validate before calling

if (cal != null) { /* pre-convert the Date yourself and call the 2-arg setDate */ }

Prevention

When it happens

Trigger: Calling PreparedStatement.setDate(parameterIndex, Date, Calendar) with a non-null Calendar on a Presto connection.

Common situations: Code ported from drivers that honor the Calendar for session-timezone conversion; developers trying to control timezone interpretation of dates.

Related errors


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