Search in sources :

Example 1 with RelTreeSignature

use of org.apache.hadoop.hive.ql.optimizer.signature.RelTreeSignature in project hive by apache.

the class StatsSources method extractStatsFromPlanMapper.

private static ImmutableList<PersistedRuntimeStats> extractStatsFromPlanMapper(PlanMapper pm) {
    Builder<PersistedRuntimeStats> li = ImmutableList.builder();
    Iterator<EquivGroup> it = pm.iterateGroups();
    while (it.hasNext()) {
        EquivGroup e = it.next();
        List<OperatorStats> stat = e.getAll(OperatorStats.class);
        List<OpTreeSignature> sig = e.getAll(OpTreeSignature.class);
        List<RelTreeSignature> rSig = e.getAll(RelTreeSignature.class);
        if (stat.size() > 1 || sig.size() > 1) {
            StringBuffer sb = new StringBuffer();
            sb.append(String.format("expected(stat-sig) 1-1, got {}-{} ;", stat.size(), sig.size()));
            for (OperatorStats s : stat) {
                sb.append(s);
                sb.append(";");
            }
            for (OpTreeSignature s : sig) {
                sb.append(s);
                sb.append(";");
            }
            LOG.debug(sb.toString());
        }
        if (stat.size() < 1 || sig.size() < 1) {
            continue;
        }
        if (e.getAll(OperatorStats.IncorrectRuntimeStatsMarker.class).size() > 0) {
            LOG.debug("Ignoring {}, marked with OperatorStats.IncorrectRuntimeStatsMarker", sig.get(0));
            continue;
        }
        if (e.getAll(OperatorStats.MayNotUseForRelNodes.class).size() > 0) {
            rSig = new ArrayList<>();
        }
        li.add(new PersistedRuntimeStats(first(sig), first(stat), first(rSig)));
    }
    return li.build();
}
Also used : OpTreeSignature(org.apache.hadoop.hive.ql.optimizer.signature.OpTreeSignature) RelTreeSignature(org.apache.hadoop.hive.ql.optimizer.signature.RelTreeSignature) EquivGroup(org.apache.hadoop.hive.ql.plan.mapper.PlanMapper.EquivGroup) OperatorStats(org.apache.hadoop.hive.ql.stats.OperatorStats)

Aggregations

OpTreeSignature (org.apache.hadoop.hive.ql.optimizer.signature.OpTreeSignature)1 RelTreeSignature (org.apache.hadoop.hive.ql.optimizer.signature.RelTreeSignature)1 EquivGroup (org.apache.hadoop.hive.ql.plan.mapper.PlanMapper.EquivGroup)1 OperatorStats (org.apache.hadoop.hive.ql.stats.OperatorStats)1