prestodb/presto · error · PrestoException

NOT_FOUND

NOT_FOUND

Error message

Schema %s does not exist

What it means

PinotMetadata.getTableHandle throws PrestoException NOT_FOUND when the requested schema name is not the connector's fixed schema ('default'). The Pinot connector only exposes one schema, so any other schema is reported as nonexistent to the engine.

Source

Thrown at presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotMetadata.java:87

    private String getPinotTableNameFromPrestoTableName(ConnectorSession session, String prestoTableName)
    {
        List<String> allTables = pinotPrestoConnection.getTableNames();
        String normalizedPrestoTableName = normalizeIdentifier(session, prestoTableName);
        for (String pinotTableName : allTables) {
            String normalizedPinotTableName = normalizeIdentifier(session, pinotTableName);
            if (normalizedPrestoTableName.equals(normalizedPinotTableName)) {
                return pinotTableName;
            }
        }
        throw new PinotException(PINOT_UNCLASSIFIED_ERROR, Optional.empty(), "Unable to find the presto table " + prestoTableName + " in " + allTables);
    }

    @Override
    public PinotTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
    {
        if (!SCHEMA_NAME.equals(normalizeIdentifier(session, tableName.getSchemaName()))) {
            throw new PrestoException(NOT_FOUND, format("Schema %s does not exist", tableName.getSchemaName()));
        }
        String pinotTableName = getPinotTableNameFromPrestoTableName(session, tableName.getTableName());
        return new PinotTableHandle(connectorId, tableName.getSchemaName(), pinotTableName);
    }

    @Override
    public ConnectorTableLayoutResult getTableLayoutForConstraint(
            ConnectorSession session,
            ConnectorTableHandle table,
            Constraint<ColumnHandle> constraint,
            Optional<Set<ColumnHandle>> desiredColumns)
    {
        // Constraint's don't need to be pushed down since they are already taken care off by the pushdown logic
        PinotTableHandle pinotTableHandle = (PinotTableHandle) table;
        ConnectorTableLayout layout = new ConnectorTableLayout(new PinotTableLayoutHandle(pinotTableHandle));
        return new ConnectorTableLayoutResult(layout, constraint.getSummary());
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use the 'default' schema: SELECT * FROM pinot.default.mytable
  2. Drop the schema qualifier entirely: SELECT * FROM mytable with the pinot catalog selected
  3. Fix the SQL generator or BI tool to omit schema qualification for the Pinot catalog

Example fix

// before
SELECT * FROM pinot.mydb.events
// after
SELECT * FROM pinot.default.events
Defensive patterns

Strategy: validation

Validate before calling

// In client code, drop schema qualification for Pinot
SchemaTableName name = new SchemaTableName("default", tableName); // never anything else

Try / catch

try {
    connector.getTableHandle(session, schemaTableName);
} catch (PrestoException e) {
    if (e.getErrorCode() == NOT_FOUND.toErrorCode()) {
        // rewrite query with schema 'default' before surfacing to user
    }
    throw e;
}

Prevention

When it happens

Trigger: A query like SELECT * FROM pinot.myschema.mytable where myschema != SCHEMA_NAME ("default"), or a fully qualified reference using a wrong schema name.

Common situations: Copying SQL written for another connector (Postgres/MySQL) with a database/schema qualifier; tools generating schema-qualified names; catalog misused as schema name.

Understand the failure class

Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.

Related errors


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