{"record":{"id":"134f1351b7810cef","repo":"apache/beam","slug":"table-s-not-found-sqldropobject","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/SqlDropObject.java","lineNumber":85,"sourceCode":"      schema = schema.getSubSchema(p, true);\n      if (schema == null) {\n        throw new AssertionError(String.format(\"Got null sub-schema for path '%s' in %s\", p, path));\n      }\n    }\n    final boolean existed;\n    switch (getKind()) {\n      case DROP_TABLE:\n        if (schema.schema instanceof BeamCalciteSchema) {\n          BeamCalciteSchema beamSchema = (BeamCalciteSchema) schema.schema;\n          existed = beamSchema.getTableProvider().getTable(name.getSimple()) != null;\n          if (existed) {\n            beamSchema.getTableProvider().dropTable(name.getSimple());\n          }\n        } else {\n          existed = schema.removeTable(name.getSimple());\n        }\n        if (!existed && !ifExists) {\n          throw SqlUtil.newContextException(\n              name.getParserPosition(), RESOURCE.tableNotFound(name.getSimple()));\n        }\n        break;\n      default:\n        throw new AssertionError(getKind());\n    }\n  }\n}\n\n// End SqlDropObject.java\n","sourceCodeStart":67,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlDropObject.java#L67-L96","documentation":"Thrown by DROP TABLE (within SqlDropObject) when the table to drop does not exist in the schema (removeTable/tableProvider.dropTable report non-existence) and IF EXISTS was not specified. Calcite's RESOURCE.tableNotFound produces the parse-context error.","triggerScenarios":"`DROP TABLE <name>` where the table is absent from the resolved schema and IF EXISTS is omitted.","commonSituations":"Idempotent cleanup scripts re-run; dropping a table created in a different catalog/database path; case-sensitivity or quoting mismatches in the table name.","solutions":["Add IF EXISTS: DROP TABLE IF EXISTS <name>","Verify the table name and catalog/database qualification","List existing tables to confirm the name","Check quoting/case sensitivity of the identifier"],"exampleFix":"// before\nDROP TABLE orders;\n// after\nDROP TABLE IF EXISTS orders;","handlingStrategy":"validation","validationCode":"boolean exists = schema.getTableNames().stream()\n    .anyMatch(n -> n.getSimple().equalsIgnoreCase(\"orders\"));\nif (!exists) { /* skip drop */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use DROP TABLE IF EXISTS for cleanup scripts","Qualify table names with the correct catalog/database","Watch identifier case-sensitivity and quoting"],"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"}