{"record":{"id":"a1f873c65f55d00e","repo":"prestodb/presto","slug":"not-found-a1f873","errorCode":"NOT_FOUND","errorMessage":"Schema %s does not exist","messagePattern":"Schema (.+?) does not exist","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-druid/src/main/java/com/facebook/presto/druid/DruidMetadata.java","lineNumber":81,"sourceCode":"    @Inject\n    public DruidMetadata(DruidClient druidClient, DruidConfig druidConfig)\n    {\n        this.druidClient = requireNonNull(druidClient, \"druidClient is null\");\n        this.druidConfig = requireNonNull(druidConfig, \"druidConfig is null\");\n    }\n\n    @Override\n    public List<String> listSchemaNames(ConnectorSession session)\n    {\n        return druidClient.getSchemas();\n    }\n\n    @Override\n    public ConnectorTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)\n    {\n        if (!normalizeIdentifier(session, druidClient.getSchema()).equals\n                (normalizeIdentifier(session, tableName.getSchemaName()))) {\n            throw new PrestoException(NOT_FOUND, format(\"Schema %s does not exist\", tableName.getSchemaName()));\n        }\n        return druidClient.getTables().stream()\n                .filter(name -> name.equals(tableName.getTableName()))\n                .map(name -> fromSchemaTableName(tableName))\n                .findFirst()\n                .orElse(null);\n    }\n\n    @Override\n    public ConnectorTableLayoutResult getTableLayoutForConstraint(\n            ConnectorSession session,\n            ConnectorTableHandle table,\n            Constraint<ColumnHandle> constraint,\n            Optional<Set<ColumnHandle>> desiredColumns)\n    {\n        DruidTableHandle handle = (DruidTableHandle) table;\n        ConnectorTableLayout layout = new ConnectorTableLayout(new DruidTableLayoutHandle(handle, constraint.getSummary()));\n        return new ConnectorTableLayoutResult(layout, constraint.getSummary());","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-druid/src/main/java/com/facebook/presto/druid/DruidMetadata.java#L63-L99","documentation":"DruidMetadata.getTableHandle throws NOT_FOUND when the requested SchemaTableName's schema does not match the Druid connector's single configured schema (druidClient.getSchema()). The Druid connector only exposes one schema, so any other schema name is reported as nonexistent. Note the same method returns null (table not found) rather than throwing when the schema matches but the table does not.","triggerScenarios":"Querying druid <table> where <schema> is anything other than the connector's configured schema (default 'druid'); SHOW TABLES FROM <wrong_schema>; metadata lookups from views or other connectors passing fully qualified names with a mismatched schema.","commonSituations":"Typo in catalog/schema qualification (e.g. SELECT * FROM druid.default.events); queries ported from other connectors that use different schema names; case-sensitivity mismatches resolved via normalizeIdentifier.","solutions":["Use the correct schema name (the connector's configured schema, typically 'druid'): SELECT * FROM druid.<table>.","Check the Druid connector properties (druid.schema / metadata config) to confirm which schema is exposed.","Run SHOW TABLES FROM <catalog> to list valid names before querying.","If the query is generated by a tool, fix the schema qualification in the tool's connection settings."],"exampleFix":"// before\nSELECT * FROM druid.default.events;\n-- after\nSELECT * FROM druid.events; -- Druid connector exposes a single schema","handlingStrategy":"validation","validationCode":"// Resolve the correct fully-qualified name before querying:\nString catalog = \"druid\";\nString schema = \"druid\"; // Druid connector exposes a single schema\nString table = \"events\";\nResultSet rs = stmt.executeQuery(\"SELECT table_schema FROM information_schema.tables WHERE table_catalog='druid' AND table_name='\" + table + \"'\");\nif (!rs.next()) {\n    throw new IllegalArgumentException(\"Table \" + table + \" not exposed by Druid connector; check schema name (got: expected druid.*)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return query(\"SELECT * FROM druid.\" + table);\n}\ncatch (PrestoException e) {\n    if (\"NOT_FOUND\".equals(e.getErrorCode().getName()) && e.getMessage().contains(\"does not exist\")) {\n        throw new IllegalArgumentException(\"Wrong schema; Druid connector only serves its configured schema (default druid)\", e);\n    }\n    throw e;\n}","preventionTips":["Always qualify Druid tables with the connector's single schema (usually 'druid'), not schema names from other catalogs.","Run SHOW SCHEMAS / SHOW TABLES FROM druid to discover valid identifiers.","Fix query-generator or BI tool settings that inject foreign schema names.","Watch identifier case handling: normalization is applied, but source queries should use the canonical name."],"tags":["druid","metadata","schema-not-found","not-found"],"backgroundTag":"schema-does-not-exist","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}