code: @Override
    public void commit()
        throws IOException {
      this.closer.close();
  
      setStagingFileGroup();
  
      if (!this.fs.exists(this.stagingFile)) {
        throw new IOException(String.format("File %s does not exist", this.stagingFile));
      }
  
      FileStatus stagingFileStatus = this.fs.getFileStatus(this.stagingFile);
  
      // Double check permission of staging file
      if (!stagingFileStatus.getPermission().equals(this.filePermission)) {
        this.fs.setPermission(this.stagingFile, this.filePermission);
      }
  
      this.bytesWritten = Optional.of(Long.valueOf(stagingFileStatus.getLen()));
  
      LOG.info(String.format("Moving data from %s to %s", this.stagingFile, this.outputFile));
      // For the same reason as deleting the staging file if it already exists, overwrite
      // the output file if it already exists to prevent task retry from being blocked.
      HadoopUtils.renamePath(this.fileContext, this.stagingFile, this.outputFile, true);
  
      // The staging file is moved to the output path in commit, so rename to add record count after that
      if (this.shouldIncludeRecordCountInFileName) {
        String filePathWithRecordCount = addRecordCountToFileName();
        this.properties.appendToSetProp(this.allOutputFilesPropName, filePathWithRecordCount);
      } else {
        this.properties.appendToSetProp(this.allOutputFilesPropName, getOutputFilePath());
      }
  
      FsWriterMetrics metrics = new FsWriterMetrics(
          this.id,
          new PartitionIdentifier(this.partitionKey, this.branchId),
          ImmutableSet.of(new FsWriterMetrics.FileInfo(this.outputFile.getName(), recordsWritten()))
      );
      this.properties.setProp(FS_WRITER_METRICS_KEY, metrics.toJson());
   }
docs: {@inheritDoc}.
  
  <p>
  This default implementation simply renames the staging file to the output file. If the output file
  already exists, it will delete it first before doing the renaming.
  </p>
  
  @throws IOException if any file operation fails