{"record":{"id":"ab2ecddd4b79c984","repo":"apache/seatunnel","slug":"skip-deleting-table-directory-because-target-path","errorCode":null,"errorMessage":"Skip deleting table directory because target path has no separator: {}","messagePattern":"Skip deleting table directory because target path has no separator: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/commit/HiveSinkAggregatedCommitter.java","lineNumber":199,"sourceCode":"                continue;\n            }\n\n            try {\n                // Get the first target path from transactionMap\n                String targetPath =\n                        transactionMap.values().stream()\n                                .flatMap(m -> m.values().stream())\n                                .findFirst()\n                                .orElseThrow(\n                                        () -> new IllegalStateException(\"No target paths found\"));\n\n                if (aggregatedCommitInfo.getPartitionDirAndValuesMap().isEmpty()) {\n                    // For non-partitioned table, extract and delete table directory\n                    // Example: hdfs://hadoop-master1:8020/warehouse/test_overwrite_1/\n                    int lastSeparator =\n                            Math.max(targetPath.lastIndexOf('/'), targetPath.lastIndexOf('\\\\'));\n                    if (lastSeparator <= 0) {\n                        log.warn(\n                                \"Skip deleting table directory because target path has no separator: {}\",\n                                targetPath);\n                        continue;\n                    }\n                    String tableDir = targetPath.substring(0, lastSeparator);\n                    if (deleteTargetDirectoryOnce(tableDir)) {\n                        log.info(\"Deleted table directory: {}\", tableDir);\n                        anyDeleted = true;\n                    }\n                } else {\n                    // For partitioned table, extract and delete partition directories\n                    // Example:\n                    // hdfs://hadoop-master1:8020/warehouse/test_overwrite_partition/age=26/\n                    Set<String> partitionDirs =\n                            transactionMap.values().stream()\n                                    .flatMap(m -> m.values().stream())\n                                    .map(\n                                            path -> {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/commit/HiveSinkAggregatedCommitter.java#L181-L217","documentation":"When committing a non-partitioned Hive write, the committer tries to strip the last path segment from the target location to obtain the table directory and delete it. If the target path has no '/' or '\\\\' separator, the substring would be meaningless, so it logs this warning and skips the deletion instead of corrupting the path.","triggerScenarios":"HiveSinkAggregatedCommitter.deleteDirectories() (called from commit) processes a non-partitioned table whose aggregated targetPath contains no path separator (lastSeparator <= 0).","commonSituations":"Target configured as a bare relative name like 'test_overwrite_1' instead of a full URI such as hdfs://host:8020/warehouse/db.db/test_overwrite_1, or an odd filesystem path scheme.","solutions":["Set the Hive sink target/location to a fully-qualified path including separators, e.g. hdfs://namenode:8020/warehouse/db.db/table","Verify the table location in the Hive metastore is a proper URI rather than a bare string","If the warning appears, manually clean up the stale table directory if overwrite semantics require it"],"exampleFix":"// before\n\"target_path\" = \"test_overwrite_1\"\n// after\n\"target_path\" = \"hdfs://hadoop-master1:8020/warehouse/test.db/test_overwrite_1\"","handlingStrategy":"validation","validationCode":"String p = targetPath;\nif (p.lastIndexOf('/') <= 0 && p.lastIndexOf('\\\\') <= 0) {\n  throw new IllegalArgumentException(\"target_path must be a full path with separators: \" + p);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure full hdfs:// URIs as Hive sink targets","Validate table location URIs from the metastore before overwrite jobs","Confirm the resulting table dir exists after commits when overwrite is used"],"tags":["hive","hdfs","path","committer"],"backgroundTag":"invalid-url-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}