Package org.apache.hadoop.hive.ql.plan

Examples of org.apache.hadoop.hive.ql.plan.explain


    Annotation note = work.getClass().getAnnotation(Explain.class);

    String keyJSONObject = null;

    if (note instanceof Explain) {
      Explain xpl_note = (Explain) note;
      if (extended || xpl_note.normalExplain()) {
        keyJSONObject = xpl_note.displayName();
        if (out != null) {
          out.print(indentString(indent));
          if (appendToHeader != null && !appendToHeader.isEmpty()) {
            out.println(xpl_note.displayName() + appendToHeader);
          } else {
            out.println(xpl_note.displayName());
          }
        }
      }
    }

    JSONObject json = jsonOutput ? new JSONObject() : null;
    // If this is an operator then we need to call the plan generation on the
    // conf and then the children
    if (work instanceof Operator) {
      Operator<? extends OperatorDesc> operator =
        (Operator<? extends OperatorDesc>) work;
      if (operator.getConf() != null) {
        String appender = isLogical ? " (" + operator.getOperatorId() + ")" : "";
        JSONObject jsonOut = outputPlan(operator.getConf(), out, extended,
            jsonOutput, jsonOutput ? 0 : indent, appender);
        if (jsonOutput) {
          json.put(operator.getOperatorId(), jsonOut);
        }
      }

      if (!visitedOps.contains(operator) || !isLogical) {
        visitedOps.add(operator);
        if (operator.getChildOperators() != null) {
          int cindent = jsonOutput ? 0 : indent + 2;
          for (Operator<? extends OperatorDesc> op : operator.getChildOperators()) {
            JSONObject jsonOut = outputPlan(op, out, extended, jsonOutput, cindent);
            if (jsonOutput) {
              json.put(operator.getOperatorId(), jsonOut);
            }
          }
        }
      }

      if (jsonOutput) {
        if (keyJSONObject != null) {
          JSONObject ret = new JSONObject();
          ret.put(keyJSONObject, json);
          return ret;
        }

        return json;
      }
      return null;
    }

    // We look at all methods that generate values for explain
    Method[] methods = work.getClass().getMethods();
    Arrays.sort(methods, new MethodComparator());

    for (Method m : methods) {
      int prop_indents = jsonOutput ? 0 : indent + 2;
      note = m.getAnnotation(Explain.class);

      if (note instanceof Explain) {
        Explain xpl_note = (Explain) note;

        if (extended || xpl_note.normalExplain()) {

          Object val = null;
          try {
            val = m.invoke(work);
          }
          catch (InvocationTargetException ex) {
            // Ignore the exception, this may be caused by external jars
            val = null;
          }

          if (val == null) {
            continue;
          }

          String header = null;
          boolean skipHeader = xpl_note.skipHeader();
          boolean emptyHeader = false;

          if (!xpl_note.displayName().equals("")) {
            header = indentString(prop_indents) + xpl_note.displayName() + ":";
          }
          else {
            emptyHeader = true;
            prop_indents = indent;
            header = indentString(prop_indents);
View Full Code Here


      int indent) throws Exception {
    // Check if work has an explain annotation
    Annotation note = work.getClass().getAnnotation(Explain.class);

    if (note instanceof Explain) {
      Explain xpl_note = (Explain) note;
      if (extended || xpl_note.normalExplain()) {
        out.print(indentString(indent));
        out.println(xpl_note.displayName());
      }
    }

    // If this is an operator then we need to call the plan generation on the
    // conf and then
View Full Code Here

    for (Method m : methods) {
      int prop_indents = indent + 2;
      note = m.getAnnotation(Explain.class);

      if (note instanceof Explain) {
        Explain xpl_note = (Explain) note;

        if (extended || xpl_note.normalExplain()) {

          Object val = m.invoke(work);

          if (val == null) {
            continue;
          }

          String header = null;
          if (!xpl_note.displayName().equals("")) {
            header = indentString(prop_indents) + xpl_note.displayName() + ":";
          } else {
            prop_indents = indent;
            header = indentString(prop_indents);
          }
View Full Code Here

    throws Exception {
    // Check if work has an explain annotation
    Annotation note = work.getClass().getAnnotation(explain.class);
   
    if (note instanceof explain) {
      explain xpl_note = (explain)note;
      if (extended || xpl_note.normalExplain()) {
        out.print(indentString(indent));
        out.println(xpl_note.displayName());
      }
    }

    // If this is an operator then we need to call the plan generation on the conf and then
    // the children
    if (work instanceof Operator) {
      Operator<? extends Serializable> operator = (Operator<? extends Serializable>) work;
      if (operator.getConf() != null) {
        outputPlan(operator.getConf(), out, extended, indent);
      }
      if (operator.getChildOperators() != null) {
        for(Operator<? extends Serializable> op: operator.getChildOperators()) {
          outputPlan(op, out, extended, indent+2);
        }
      }
      return;
    }
   
    // We look at all methods that generate values for explain
    Method[] methods = work.getClass().getMethods();
    Arrays.sort(methods, new MethodComparator());

    for(Method m: methods) {
      int prop_indents = indent+2;
      note = m.getAnnotation(explain.class);

      if (note instanceof explain) {
        explain xpl_note = (explain)note;

        if (extended || xpl_note.normalExplain()) {
         
          Object val = m.invoke(work);

          if (val == null) {
            continue;
          }
         
          String header = null;
          if (!xpl_note.displayName().equals("")){
            header = indentString(prop_indents) + xpl_note.displayName() +":";
          } else {
            prop_indents = indent;
            header = indentString(prop_indents);
          }
View Full Code Here

    throws Exception {
    // Check if work has an explain annotation
    Annotation note = work.getClass().getAnnotation(explain.class);
   
    if (note instanceof explain) {
      explain xpl_note = (explain)note;
      if (extended || xpl_note.normalExplain()) {
        out.print(indentString(indent));
        out.println(xpl_note.displayName());
      }
    }

    // If this is an operator then we need to call the plan generation on the conf and then
    // the children
    if (work instanceof Operator) {
      Operator<? extends Serializable> operator = (Operator<? extends Serializable>) work;
      if (operator.getConf() != null) {
        outputPlan(operator.getConf(), out, extended, indent);
      }
      if (operator.getChildOperators() != null) {
        for(Operator<? extends Serializable> op: operator.getChildOperators()) {
          outputPlan(op, out, extended, indent+2);
        }
      }
      return;
    }
   
    // We look at all methods that generate values for explain
    Method[] methods = work.getClass().getMethods();
    Arrays.sort(methods, new MethodComparator());

    for(Method m: methods) {
      int prop_indents = indent+2;
      note = m.getAnnotation(explain.class);

      if (note instanceof explain) {
        explain xpl_note = (explain)note;

        if (extended || xpl_note.normalExplain()) {
         
          Object val = m.invoke(work);

          if (val == null) {
            continue;
          }
         
          String header = null;
          if (!xpl_note.displayName().equals("")){
            header = indentString(prop_indents) + xpl_note.displayName() +":";
          } else {
            prop_indents = indent;
            header = indentString(prop_indents);
          }
View Full Code Here

    throws Exception {
    // Check if work has an explain annotation
    Annotation note = work.getClass().getAnnotation(explain.class);
   
    if (note instanceof explain) {
      explain xpl_note = (explain)note;
      if (extended || xpl_note.normalExplain()) {
        out.print(indentString(indent));
        out.println(xpl_note.displayName());
      }
    }

    // If this is an operator then we need to call the plan generation on the conf and then
    // the children
    if (work instanceof Operator) {
      Operator<? extends Serializable> operator = (Operator<? extends Serializable>) work;
      if (operator.getConf() != null) {
        outputPlan(operator.getConf(), out, extended, indent);
      }
      if (operator.getChildOperators() != null) {
        for(Operator<? extends Serializable> op: operator.getChildOperators()) {
          outputPlan(op, out, extended, indent+2);
        }
      }
      return;
    }
   
    // We look at all methods that generate values for explain
    Method[] methods = work.getClass().getMethods();
    Arrays.sort(methods, new MethodComparator());

    for(Method m: methods) {
      int prop_indents = indent+2;
      note = m.getAnnotation(explain.class);

      if (note instanceof explain) {
        explain xpl_note = (explain)note;

        if (extended || xpl_note.normalExplain()) {
         
          Object val = m.invoke(work);

          if (val == null) {
            continue;
          }
         
          String header = null;
          if (!xpl_note.displayName().equals("")){
            header = indentString(prop_indents) + xpl_note.displayName() +":";
          } else {
            prop_indents = indent;
            header = indentString(prop_indents);
          }
View Full Code Here

    throws Exception {
    // Check if work has an explain annotation
    Annotation note = work.getClass().getAnnotation(explain.class);
   
    if (note instanceof explain) {
      explain xpl_note = (explain)note;
      if (extended || xpl_note.normalExplain()) {
        out.print(indentString(indent));
        out.println(xpl_note.displayName());
      }
    }

    // If this is an operator then we need to call the plan generation on the conf and then
    // the children
    if (work instanceof Operator) {
      Operator<? extends Serializable> operator = (Operator<? extends Serializable>) work;
      if (operator.getConf() != null) {
        outputPlan(operator.getConf(), out, extended, indent);
      }
      if (operator.getChildOperators() != null) {
        for(Operator<? extends Serializable> op: operator.getChildOperators()) {
          outputPlan(op, out, extended, indent+2);
        }
      }
      return;
    }
   
    // We look at all methods that generate values for explain
    Method[] methods = work.getClass().getMethods();
    Arrays.sort(methods, new MethodComparator());

    for(Method m: methods) {
      int prop_indents = indent+2;
      note = m.getAnnotation(explain.class);

      if (note instanceof explain) {
        explain xpl_note = (explain)note;

        if (extended || xpl_note.normalExplain()) {
         
          Object val = m.invoke(work);

          if (val == null) {
            continue;
          }
         
          String header = null;
          if (!xpl_note.displayName().equals("")){
            header = indentString(prop_indents) + xpl_note.displayName() +":";
          } else {
            prop_indents = indent;
            header = indentString(prop_indents);
          }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.plan.explain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.