prestodb/presto · error · NotImplementedException

DatabaseMetaData

Error message

DatabaseMetaData

What it means

getFunctions() in PrestoDatabaseMetaData throws NotImplementedException('DatabaseMetaData', 'getFunctions'). The driver has not implemented listing SQL functions via JDBC metadata yet, even though Presto itself has functions. The NotImplementedException is a marker from the air lift/joda helper indicating an interface method that is still a TODO.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoDatabaseMetaData.java:1367

    {
        return select(format("SELECT * FROM (VALUES%n" +
                        "        ('ApplicationName', %s, 'presto-jdbc', 'Sets the source of the session'),%n" +
                        "        ('ClientInfo', %s, NULL, 'Sets the client info of the session'),        %n" +
                        "        ('ClientTags', %s, NULL, 'Comma-delimited string of tags for the session'),        %n" +
                        "        ('TraceToken', %s, NULL, 'Sets the trace token of the session')        %n" +
                        ") AS t (NAME, MAX_LEN, DEFAULT_VALUE, DESCRIPTION)",
                MAX_LENGTH,
                MAX_LENGTH,
                MAX_LENGTH,
                MAX_LENGTH));
    }

    @Override
    public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern)
            throws SQLException
    {
        // TODO: implement this
        throw new NotImplementedException("DatabaseMetaData", "getFunctions");
    }

    @Override
    public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern)
            throws SQLException
    {
        // TODO: implement this
        throw new NotImplementedException("DatabaseMetaData", "getFunctionColumns");
    }

    @Override
    public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
            throws SQLException
    {
        return selectEmpty("" +
                "SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE,\n" +
                "  COLUMN_SIZE, DECIMAL_DIGITS, NUM_PREC_RADIX, COLUMN_USAGE, REMARKS,\n" +
                "  CHAR_OCTET_LENGTH, IS_NULLABLE\n" +

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Avoid getFunctions on Presto; document available functions from Presto docs instead
  2. Catch NotImplementedException and return an empty functions result
  3. Query Presto system catalogs (e.g. SHOW FUNCTIONS) via Statement instead of metadata API
  4. Upgrade the Presto JDBC driver to a version where getFunctions is implemented, if available

Example fix

// before
ResultSet fns = meta.getFunctions(catalog, schemaPattern, "%");
// after
ResultSet fns;
try {
    fns = meta.getFunctions(catalog, schemaPattern, "%");
} catch (NotImplementedException e) {
    fns = stmt.executeQuery("SHOW FUNCTIONS"); // Presto-specific fallback
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean supportsGetFunctions = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);

Type guard

boolean supportsGetFunctions = !(meta instanceof com.facebook.presto.jdbc.PrestoDatabaseMetaData);

Try / catch

try (ResultSet rs = meta.getFunctions(cat, schemaPattern, fnPattern)) { ... } catch (NotImplementedException e) { /* fall back to SHOW FUNCTIONS via Statement */ }

Prevention

When it happens

Trigger: Calling DatabaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern) on a Presto connection — e.g. IDE function completion or documentation tools.

Common situations: SQL editors with autocomplete that enumerate functions, metadata-crawling tools, upgrading JDBC client versions whose tooling newly calls getFunctions.

Related errors


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