Source:
public CompletableFuture<FSDataInputStream> openFileWithOptions( final Path rawPath, final OpenFileParameters parameters) throws IOException { final Path path = qualify(rawPath); Configuration options = parameters.getOptions(); Set<String> mandatoryKeys = parameters.getMandatoryKeys(); String sql = options.get(SelectConstants.SELECT_SQL, null); boolean isSelect = sql != null; if (isSelect) { rejectUnknownMandatoryKeys( mandatoryKeys, InternalSelectConstants.SELECT_OPTIONS, "for " + path + " in S3 Select operation"); } else { rejectUnknownMandatoryKeys( mandatoryKeys, InternalConstants.STANDARD_OPENFILE_KEYS, "for " + path + " in non-select file I/O"); } FileStatus status = parameters.getStatus(); S3AFileStatus fileStatus = null; if (status != null) { Preconditions.checkArgument(path.equals(status.getPath()), "FileStatus parameter is not for the path %s: %s", path, status); if (status instanceof S3AFileStatus) { LOG.debug("File was opened with a supplied S3AFileStatus;" + " skipping getFileStatus call in open() operation: {}", status); fileStatus = (S3AFileStatus) status; } else if (status instanceof S3ALocatedFileStatus) { LOG.debug("File was opened with a supplied S3ALocatedFileStatus;" + " skipping getFileStatus call in open() operation: {}", status); fileStatus = ((S3ALocatedFileStatus) status).toS3AFileStatus(); } else { LOG.debug("Ignoring file status {}", status); } } S3AFileStatus st = fileStatus; CompletableFuture<FSDataInputStream> result = new CompletableFuture<>(); if (!isSelect) { unboundedThreadPool.submit(() -> LambdaUtils.eval(result, () -> open(path, Optional.of(options), st))); } else { requireSelectSupport(path); unboundedThreadPool.submit(() -> LambdaUtils.eval(result, () -> select(path, sql, options))); } return result; }

Target:
public CompletableFuture<FSDataInputStream> openFileWithOptions( final Path rawPath, final OpenFileParameters parameters) throws IOException { final Path path = qualify(rawPath); Configuration options = parameters.getOptions(); Set<String> mandatoryKeys = parameters.getMandatoryKeys(); String sql = options.get(SelectConstants.SELECT_SQL, null); boolean isSelect = sql != null; if (isSelect) { rejectUnknownMandatoryKeys( mandatoryKeys, InternalSelectConstants.SELECT_OPTIONS, "for " + path + " in S3 Select operation"); } else { rejectUnknownMandatoryKeys( mandatoryKeys, InternalConstants.STANDARD_OPENFILE_KEYS, "for " + path + " in non-select file I/O"); } FileStatus providedStatus = parameters.getStatus(); S3AFileStatus fileStatus; if (providedStatus != null) { Preconditions.checkArgument(path.equals(providedStatus.getPath()), "FileStatus parameter is not for the path %s: %s", path, providedStatus); if (providedStatus instanceof S3AFileStatus) { LOG.debug("File was opened with a supplied S3AFileStatus;" + " skipping getFileStatus call in open() operation: {}", providedStatus); fileStatus = (S3AFileStatus) providedStatus; } else if (providedStatus instanceof S3ALocatedFileStatus) { LOG.debug("File was opened with a supplied S3ALocatedFileStatus;" + " skipping getFileStatus call in open() operation: {}", providedStatus); fileStatus = ((S3ALocatedFileStatus) providedStatus).toS3AFileStatus(); } else { LOG.debug("Ignoring file status {}", providedStatus); fileStatus = null; } } else { fileStatus = null; } Optional<S3AFileStatus> ost = Optional.ofNullable(fileStatus); CompletableFuture<FSDataInputStream> result = new CompletableFuture<>(); if (!isSelect) { unboundedThreadPool.submit(() -> LambdaUtils.eval(result, () -> open(path, Optional.of(options), ost))); } else { requireSelectSupport(path); unboundedThreadPool.submit(() -> LambdaUtils.eval(result, () -> select(path, sql, options, ost))); } return result; }