Search in sources :

Example 16 with FileSinkOperator

use of org.apache.hadoop.hive.ql.exec.FileSinkOperator in project hive by apache.

the class SparkTask method getOperatorCounters.

private Map<String, List<String>> getOperatorCounters() {
    String groupName = HiveConf.getVar(conf, HiveConf.ConfVars.HIVECOUNTERGROUP);
    Map<String, List<String>> counters = new HashMap<String, List<String>>();
    List<String> hiveCounters = new LinkedList<String>();
    counters.put(groupName, hiveCounters);
    hiveCounters.add(Operator.HIVECOUNTERCREATEDFILES);
    // Spark transformation and Hive operators in SparkWork.
    for (MapOperator.Counter counter : MapOperator.Counter.values()) {
        hiveCounters.add(counter.toString());
    }
    SparkWork sparkWork = this.getWork();
    for (BaseWork work : sparkWork.getAllWork()) {
        for (Operator<? extends OperatorDesc> operator : work.getAllOperators()) {
            if (operator instanceof FileSinkOperator) {
                for (FileSinkOperator.Counter counter : FileSinkOperator.Counter.values()) {
                    hiveCounters.add(((FileSinkOperator) operator).getCounterName(counter));
                }
            } else if (operator instanceof ReduceSinkOperator) {
                for (ReduceSinkOperator.Counter counter : ReduceSinkOperator.Counter.values()) {
                    hiveCounters.add(((ReduceSinkOperator) operator).getCounterName(counter, conf));
                }
            } else if (operator instanceof ScriptOperator) {
                for (ScriptOperator.Counter counter : ScriptOperator.Counter.values()) {
                    hiveCounters.add(counter.toString());
                }
            } else if (operator instanceof JoinOperator) {
                for (JoinOperator.SkewkeyTableCounter counter : JoinOperator.SkewkeyTableCounter.values()) {
                    hiveCounters.add(counter.toString());
                }
            }
        }
    }
    return counters;
}
Also used : JoinOperator(org.apache.hadoop.hive.ql.exec.JoinOperator) FileSinkOperator(org.apache.hadoop.hive.ql.exec.FileSinkOperator) HashMap(java.util.HashMap) ScriptOperator(org.apache.hadoop.hive.ql.exec.ScriptOperator) SparkWork(org.apache.hadoop.hive.ql.plan.SparkWork) LinkedList(java.util.LinkedList) MapOperator(org.apache.hadoop.hive.ql.exec.MapOperator) ReduceSinkOperator(org.apache.hadoop.hive.ql.exec.ReduceSinkOperator) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) BaseWork(org.apache.hadoop.hive.ql.plan.BaseWork)

Aggregations

FileSinkOperator (org.apache.hadoop.hive.ql.exec.FileSinkOperator)16 Operator (org.apache.hadoop.hive.ql.exec.Operator)8 TableScanOperator (org.apache.hadoop.hive.ql.exec.TableScanOperator)7 ArrayList (java.util.ArrayList)6 Path (org.apache.hadoop.fs.Path)6 ReduceSinkOperator (org.apache.hadoop.hive.ql.exec.ReduceSinkOperator)5 Serializable (java.io.Serializable)4 JoinOperator (org.apache.hadoop.hive.ql.exec.JoinOperator)4 FileSinkDesc (org.apache.hadoop.hive.ql.plan.FileSinkDesc)4 MapWork (org.apache.hadoop.hive.ql.plan.MapWork)4 OperatorDesc (org.apache.hadoop.hive.ql.plan.OperatorDesc)4 HiveConf (org.apache.hadoop.hive.conf.HiveConf)3 FetchTask (org.apache.hadoop.hive.ql.exec.FetchTask)3 Task (org.apache.hadoop.hive.ql.exec.Task)3 UnionOperator (org.apache.hadoop.hive.ql.exec.UnionOperator)3 ParseContext (org.apache.hadoop.hive.ql.parse.ParseContext)3 MapredWork (org.apache.hadoop.hive.ql.plan.MapredWork)3 TableDesc (org.apache.hadoop.hive.ql.plan.TableDesc)3 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2