code: public static Resource getResultResource(final JavaSparkContext sparkContext,
              final SparkJobContext sparkJobContext) {
          final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext);
  
          URI resultPath = sparkJobContext.getResultPath();
          if (resultPath == null) {
              resultPath = URI.create(SparkRunner.DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext));
          } else {
              if (hdfsHelper.isDirectory(resultPath)) {
                  if (resultPath.toString().endsWith("/")) {
                      resultPath = URI.create(resultPath.toString() + generateResultFilename(sparkJobContext));
                  } else {
                      resultPath = URI.create(resultPath.toString() + '/' + generateResultFilename(sparkJobContext));
                  }
              } else {
                  resultPath = sparkJobContext.getResultPath();
              }
          }
  
          return hdfsHelper.getResourceToUse(resultPath);
      }
docs: Gets the Resource to use for the job's result. The path can be configured
  in the job properties file with property 'datacleaner.result.hdfs.path'.
  The path can be absolute(
  'hdfs://[hostname]:[port]/myresults/myjob.analysis.result.dat') or
  relative('/myresults/myjob.analysis.result.dat'). If no path is set in
  the properties file and the system is configured to save the results, the
  default path will be saved to
  '/datacleaner/results/[jobname]-[timestamp].analysis.result.dat
  
  @return a Resource to use