use of org.apache.hadoop.hive.ql.plan.IStatsGatherDesc in project hive by apache.
the class Utilities method getStatsTmpDirs.
public static List<String> getStatsTmpDirs(BaseWork work, Configuration conf) {
List<String> statsTmpDirs = new ArrayList<>();
if (!StatsSetupConst.StatDB.fs.name().equalsIgnoreCase(HiveConf.getVar(conf, ConfVars.HIVESTATSDBCLASS))) {
// no-op for non-fs stats collection
return statsTmpDirs;
}
// if its auto-stats gather for inserts or CTAS, stats dir will be in FileSink
Set<Operator<? extends OperatorDesc>> ops = work.getAllLeafOperators();
if (work instanceof MapWork) {
// if its an anlayze statement, stats dir will be in TableScan
ops.addAll(work.getAllRootOperators());
}
for (Operator<? extends OperatorDesc> op : ops) {
OperatorDesc desc = op.getConf();
String statsTmpDir = null;
if (desc instanceof IStatsGatherDesc) {
statsTmpDir = ((IStatsGatherDesc) desc).getTmpStatsDir();
}
if (statsTmpDir != null && !statsTmpDir.isEmpty()) {
statsTmpDirs.add(statsTmpDir);
}
}
return statsTmpDirs;
}
Aggregations