Search in sources :

Example 1 with IStatsGatherDesc

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;
}
Also used : MapWork(org.apache.hadoop.hive.ql.plan.MapWork) ArrayList(java.util.ArrayList) IStatsGatherDesc(org.apache.hadoop.hive.ql.plan.IStatsGatherDesc) OperatorDesc(org.apache.hadoop.hive.ql.plan.OperatorDesc)

Aggregations

ArrayList (java.util.ArrayList)1 IStatsGatherDesc (org.apache.hadoop.hive.ql.plan.IStatsGatherDesc)1 MapWork (org.apache.hadoop.hive.ql.plan.MapWork)1 OperatorDesc (org.apache.hadoop.hive.ql.plan.OperatorDesc)1