prestodb/presto · error · NotImplementedException

Not implemented: PreparedStatement.setTime

Error message

Not implemented: PreparedStatement.setTime

What it means

setTime(int, Time, Calendar) — the Calendar-aware TIME binding — is not implemented in the Presto JDBC driver and throws NotImplementedException. The two-argument setTime works; the Calendar overload does not.

Source

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

            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)
            throws SQLException
    {
        setNull(parameterIndex, sqlType);
    }

    @Override
    public void setURL(int parameterIndex, URL x)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use the two-argument setTime(parameterIndex, Time).
  2. Convert the time to the target timezone yourself before binding.
  3. Control timezone via the connection's user/session properties.

Example fix

// before
ps.setTime(1, sqlTime, cal);
// after
ps.setTime(1, sqlTime);
Defensive patterns

Strategy: fallback

Validate before calling

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

Prevention

When it happens

Trigger: Calling PreparedStatement.setTime(parameterIndex, Time, Calendar) on a Presto connection.

Common situations: Ported code relying on Calendar-based timezone shifting of TIME values.

Related errors


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