{"record":{"id":"26e91a640616a9e3","repo":"apache/beam","slug":"support-for-move-options-is-not-yet-implemented-26e91a","errorCode":null,"errorMessage":"Support for move options is not yet implemented.","messagePattern":"Support for move options is not yet implemented\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/hadoop-file-system/src/main/java/org/apache/beam/sdk/io/hdfs/HadoopFileSystem.java","lineNumber":254,"sourceCode":"   * @throws FileNotFoundException if the source resources are missing. When rename throws, the\n   *     state of the resources is unknown but safe: for every (source, destination) pair of\n   *     resources, the following are possible: a) source exists, b) destination exists, c) source\n   *     and destination both exist. Thus no data is lost, however, duplicated resource are\n   *     possible. In such scenarios, callers can use {@code match()} to determine the state of the\n   *     resource.\n   * @throws FileAlreadyExistsException if a target resource already exists and couldn't be\n   *     overwritten.\n   * @throws IOException if the underlying filesystem indicates the rename was not performed but no\n   *     other errors were thrown.\n   */\n  @Override\n  protected void rename(\n      List<HadoopResourceId> srcResourceIds,\n      List<HadoopResourceId> destResourceIds,\n      MoveOptions... moveOptions)\n      throws IOException {\n    if (moveOptions.length > 0) {\n      throw new UnsupportedOperationException(\"Support for move options is not yet implemented.\");\n    }\n    for (int i = 0; i < srcResourceIds.size(); ++i) {\n\n      final Path srcPath = srcResourceIds.get(i).toPath();\n      final Path destPath = destResourceIds.get(i).toPath();\n\n      // this enforces src and dest file systems to match\n      final org.apache.hadoop.fs.FileSystem fs = srcPath.getFileSystem(configuration);\n\n      // rename in HDFS requires the target directory to exist or silently fails (BEAM-4861)\n      mkdirs(destPath);\n\n      boolean success = fs.rename(srcPath, destPath);\n\n      // If the failure was due to the file already existing, delete and retry (BEAM-5036).\n      // This should be the exceptional case, so handle here rather than incur the overhead of\n      // testing first\n      if (!success && fs.exists(srcPath) && fs.exists(destPath)) {","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/hadoop-file-system/src/main/java/org/apache/beam/sdk/io/hdfs/HadoopFileSystem.java#L236-L272","documentation":"HadoopFileSystem.rename() only supports renaming with no MoveOptions; passing any MoveOptions value throws UnsupportedOperationException. Move-option semantics (like atomic moves or skip-if-exists) are not implemented for Hadoop-backed file systems in Beam.","triggerScenarios":"Calling HadoopFileSystem.rename(src, dest, moveOptions...) with one or more MoveOptions values, e.g. MoveOptions.SKIP_IF_DESTINATION_EXISTS.","commonSituations":"Code written generically against Beam's FileSystem API that passes move options and works on other backends but hits the Hadoop implementation.","solutions":["Call rename() with no move options.","Implement the desired option semantics manually (e.g. check dest existence before renaming).","Use a different FileSystem implementation that supports MoveOptions if the option is essential."],"exampleFix":"// before\nfs.rename(src, dest, MoveOptions.SKIP_IF_DESTINATION_EXISTS);\n// after\nfs.rename(src, dest);","handlingStrategy":"validation","validationCode":"if (moveOptions != null && moveOptions.length > 0) {\n  throw new IllegalArgumentException(\"HadoopFileSystem does not support move options\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  fileSystem.rename(srcs, dests, moveOptions);\n} catch (UnsupportedOperationException e) {\n  fileSystem.rename(srcs, dests); // retry without options\n}","preventionTips":["Call rename() with zero MoveOptions on the Hadoop backend","Isolate backend-specific behavior behind a helper","Check the Beam FileSystem implementation docs for supported options"],"tags":["hadoop","hdfs","unsupported","beam"],"backgroundTag":"unsupported-operation","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"}