{"record":{"id":"8803823f2f372743","repo":"prestodb/presto","slug":"table-not-found-880382","errorCode":null,"errorMessage":"Table not found","messagePattern":"Table not found","errorType":"exception","errorClass":"TableNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":2749,"sourceCode":"        throw new PrestoException(NOT_SUPPORTED, \"This connector only supports delete where one or more partitions are deleted entirely\");\n    }\n\n    @Override\n    public Optional<ColumnHandle> getDeleteRowIdColumn(ConnectorSession session, ConnectorTableHandle tableHandle)\n    {\n        return Optional.of(updateRowIdHandle());\n    }\n\n    @Override\n    public OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle)\n    {\n        HiveTableHandle handle = (HiveTableHandle) tableHandle;\n        HiveTableLayoutHandle layoutHandle = (HiveTableLayoutHandle) tableLayoutHandle;\n\n        MetastoreContext metastoreContext = getMetastoreContext(session);\n        Optional<Table> table = metastore.getTable(metastoreContext, handle);\n        if (!table.isPresent()) {\n            throw new TableNotFoundException(handle.getSchemaTableName());\n        }\n\n        if (table.get().getPartitionColumns().isEmpty()) {\n            metastore.truncateUnpartitionedTable(session, handle.getSchemaName(), handle.getTableName());\n        }\n        else {\n            for (HivePartition hivePartition : getOrComputePartitions(layoutHandle, session, tableHandle)) {\n                metastore.dropPartition(session, handle.getSchemaName(), handle.getTableName(), table.get().getStorage().getLocation(), toPartitionValues(hivePartition.getPartitionId().getPartitionName()));\n            }\n        }\n        // it is too expensive to determine the exact number of deleted rows\n        return OptionalLong.empty();\n    }\n\n    private List<HivePartition> getOrComputePartitions(HiveTableLayoutHandle layoutHandle, ConnectorSession session, ConnectorTableHandle tableHandle)\n    {\n        if (layoutHandle.getPartitions().isPresent()) {\n            return layoutHandle.getPartitions().map(PartitionSet::getFullyLoadedPartitions).get();","sourceCodeStart":2731,"sourceCodeEnd":2767,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L2731-L2767","documentation":"metadataDelete resolves the table from the handle before performing a metadata-only delete; this guard fires when the table backing the handle is no longer present in the metastore (concurrently dropped) — a NOT_FOUND condition.","triggerScenarios":"Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:2749 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the table still exists (SHOW TABLES)","Retry the DELETE after refreshing metadata"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}