本文整理了Java中org.apache.hadoop.hive.ql.exec.Utilities.rename()
方法的一些代码示例,展示了Utilities.rename()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.rename()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.exec.Utilities
类名称:Utilities
方法名:rename
[英]Rename src to dst, or in the case dst already exists, move files in src to dst. If there is an existing file with the same name, the new file's name will be appended with "_1", "_2", etc.
[中]将src重命名为dst,或者在dst已经存在的情况下,将src中的文件移动到dst。如果存在同名的现有文件,则新文件的名称将附加“_1”、“_2”等。
代码示例来源:origin: apache/hive
public static Path backupOutputPath(FileSystem fs, Path outpath, JobConf job)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(), BACKUP_PREFIX
+ outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
代码示例来源:origin: apache/hive
Utilities.rename(fs, tmpPath, intermediatePath);
代码示例来源:origin: apache/drill
Utilities.rename(fs, tmpPath, intermediatePath);
代码示例来源:origin: apache/hive
private Path backupOutputPath(FileSystem fs, Path outpath)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(),
BACKUP_PREFIX + outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
代码示例来源:origin: apache/hive
Utilities.rename(fs, tmpPathOriginal, tmpPath);
代码示例来源:origin: apache/drill
public static Path backupOutputPath(FileSystem fs, Path outpath, JobConf job)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(), BACKUP_PREFIX
+ outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
Utilities.rename(fs, tmpPath, intermediatePath);
代码示例来源:origin: apache/drill
private Path backupOutputPath(FileSystem fs, Path outpath)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(),
BACKUP_PREFIX + outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
public void mvFileToFinalPath(String specPath, Configuration hconf,
boolean success, Log log, DynamicPartitionCtx dpCtx) throws IOException, HiveException {
FileSystem fs = (new Path(specPath)).getFileSystem(hconf);
Path tmpPath = Utilities.toTempPath(specPath);
Path intermediatePath = new Path(tmpPath.getParent(), tmpPath.getName()
+ ".intermediate");
Path finalPath = new Path(specPath);
if (success) {
if (fs.exists(tmpPath)) {
// Step1: rename tmp output folder to intermediate path. After this
// point, updates from speculative tasks still writing to tmpPath
// will not appear in finalPath.
log.info("Moving tmp dir: " + tmpPath + " to: " + intermediatePath);
Utilities.rename(fs, tmpPath, intermediatePath);
// Step2: remove any tmp file or double-committed output files
ArrayList<String> emptyBuckets =
Utilities.removeTempOrDuplicateFiles(fs, intermediatePath, dpCtx);
// create empty buckets if necessary
if (emptyBuckets.size() > 0) {
createEmptyBuckets(hconf, emptyBuckets);
}
// Step3: move to the file destination
log.info("Moving tmp dir: " + intermediatePath + " to: " + finalPath);
Utilities.renameOrMoveFiles(fs, intermediatePath, finalPath);
}
} else {
fs.delete(tmpPath, true);
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static Path backupOutputPath(FileSystem fs, Path outpath, JobConf job)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(), BACKUP_PREFIX
+ outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
Utilities.rename(fs, tmpPath, intermediatePath);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private Path backupOutputPath(FileSystem fs, Path outpath)
throws IOException, HiveException {
if (fs.exists(outpath)) {
Path backupPath = new Path(outpath.getParent(),
BACKUP_PREFIX + outpath.getName());
Utilities.rename(fs, outpath, backupPath);
return backupPath;
} else {
return null;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!