{"record":{"id":"74513379553b11c5","repo":"apache/beam","slug":"table-s-not-found-sqldroptable","errorCode":null,"errorMessage":"Table '%s' not found","messagePattern":"Table '(.+?)' not found","errorType":"validation","errorClass":"SqlUtil.newContextException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlDropTable.java","lineNumber":76,"sourceCode":"          pathOverride.catalog() != null\n              ? catalogManagerSchema.getCatalogSchema(pathOverride)\n              : catalogManagerSchema.getCurrentCatalogSchema();\n      beamCalciteSchema = catalogSchema.getDatabaseSchema(pathOverride);\n    } else if (schema instanceof BeamCalciteSchema) {\n      beamCalciteSchema = (BeamCalciteSchema) schema;\n    } else {\n      throw SqlUtil.newContextException(\n          name.getParserPosition(),\n          RESOURCE.internal(\n              \"Attempting to drop a table using unexpected Calcite Schema of type \"\n                  + schema.getClass()));\n    }\n\n    if (beamCalciteSchema.getTable(pair.right) == null) {\n      // Table does not exist.\n      if (!ifExists) {\n        // They did not specify IF EXISTS, so give error.\n        throw SqlUtil.newContextException(\n            name.getParserPosition(), RESOURCE.tableNotFound(name.toString()));\n      }\n      return;\n    }\n\n    beamCalciteSchema.getTableProvider().dropTable(pair.right);\n  }\n}\n\n// End SqlDropTable.java\n","sourceCodeStart":58,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlDropTable.java#L58-L87","documentation":"Thrown when DROP TABLE's target table is not found in the resolved BeamCalciteSchema (getTable returns null) and IF EXISTS was not given. Like SqlDropObject's variant, it surfaces Calcite's tableNotFound error at the parser position.","triggerScenarios":"`DROP TABLE <name>` against a BeamCalciteSchema that has no table with that simple name, without IF EXISTS.","commonSituations":"Re-running cleanup DDL; table was already dropped or never created in this session's schema; using an unqualified name while the table lives in another database/catalog.","solutions":["Use DROP TABLE IF EXISTS <name>","Qualify the table with the correct catalog/database","Re-create the table if the drop should have followed a create that failed","Check for case/quoting differences in the identifier"],"exampleFix":"// before\nDROP TABLE external_orders;\n// after\nDROP TABLE IF EXISTS external_orders;","handlingStrategy":"validation","validationCode":"boolean exists = beamCalciteSchema.getTable(\"external_orders\") != null;\nif (!exists) { /* skip drop */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer DROP TABLE IF EXISTS","Fully qualify names across catalog/database boundaries","Confirm creation succeeded before scripting the drop"],"tags":["sql","ddl","table-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}