Package org.apache.hadoop.hive.ql.session.SessionState

Examples of org.apache.hadoop.hive.ql.session.SessionState.LogHelper


  public static class RunSecondSemanticAnalysisHook extends AbstractSemanticAnalyzerHook {
    @Override
    public ASTNode preAnalyze(HiveSemanticAnalyzerHookContext context,ASTNode ast)
        throws SemanticException {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return ast;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunSecond for Pre Analysis Hook");

      Assert.assertTrue("Pre Analysis Hooks did not run in the order specified.",
                        staticAnalysisPreHookFirstRan);

      return ast;
View Full Code Here


    }

    @Override
    public void postAnalyze(HiveSemanticAnalyzerHookContext context,
        List<Task<? extends Serializable>> rootTasks) throws SemanticException {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunSecond for Post Analysis Hook");

      Assert.assertTrue("Post Analysis Hooks did not run in the order specified.",
                        staticAnalysisPostHookFirstRan);
    }
View Full Code Here

  public static class RunFirstDriverRunHook implements HiveDriverRunHook {

    @Override
    public void preDriverRun(HiveDriverRunHookContext hookContext) throws Exception {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunFirst for Pre Driver Run Hook");

      driverRunPreHookFirstRan = true;
    }
View Full Code Here

      driverRunPreHookFirstRan = true;
    }

    @Override
    public void postDriverRun(HiveDriverRunHookContext hookContext) throws Exception {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunFirst for Post Driver Run Hook");

      driverRunPostHookFirstRan = true;
    }
View Full Code Here

  public static class RunSecondDriverRunHook implements HiveDriverRunHook {

    @Override
    public void preDriverRun(HiveDriverRunHookContext hookContext) throws Exception {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunSecond for Pre Driver Run Hook");

      Assert.assertTrue("Driver Run Hooks did not run in the order specified.",
          driverRunPreHookFirstRan);
    }
View Full Code Here

          driverRunPreHookFirstRan);
    }

    @Override
    public void postDriverRun(HiveDriverRunHookContext hookContext) throws Exception {
      LogHelper console = SessionState.getConsole();

      if (console == null) {
        return;
      }

      // This is simply to verify that the hooks were in fact run
      console.printError("Running RunSecond for Post Driver Run Hook");

      Assert.assertTrue("Driver Run Hooks did not run in the order specified.",
          driverRunPostHookFirstRan);
    }
View Full Code Here

      case Task.BACKUP_COMMON_JOIN:
        backupCommonJoin++;
        break;
      }
    }
    LogHelper console = SessionState.getConsole();
    console.printError("[MapJoinCounter PostHook] COMMON_JOIN: " + commonJoin
        + " HINTED_MAPJOIN: " + hintedMapJoin + " HINTED_MAPJOIN_LOCAL: " + hintedMapJoinLocal
        + " CONVERTED_MAPJOIN: " + convertedMapJoin + " CONVERTED_MAPJOIN_LOCAL: " + convertedMapJoinLocal
        + " BACKUP_COMMON_JOIN: " + backupCommonJoin);
  }
View Full Code Here

  boolean isCreateTable;

  @Override
  public ASTNode preAnalyze(HiveSemanticAnalyzerHookContext context, ASTNode ast)
      throws SemanticException {
    LogHelper console = SessionState.getConsole();
    isCreateTable = (ast.getToken().getType() == HiveParser.TOK_CREATETABLE);
    myCount = count++;
    if (isCreateTable) {
      console.printError("DummySemanticAnalyzerHook1 Pre: Count " + myCount);
    }
    return ast;
  }
View Full Code Here

      tblProps = new HashMap<String, String>();
    }
    tblProps.put("createdBy", DummyCreateTableHook.class.getName());
    tblProps.put("Message", "Hive rocks!! Count: " + myCount);

    LogHelper console = SessionState.getConsole();
    console.printError("DummySemanticAnalyzerHook1 Post: Hive rocks!! Count: " + myCount);
  }
View Full Code Here

        tableAccessInfo.getOperatorToTableAccessMap() == null ||
        tableAccessInfo.getOperatorToTableAccessMap().isEmpty()) {
      return;
    }

    LogHelper console = SessionState.getConsole();
    Map<Operator<? extends OperatorDesc>, Map<String, List<String>>> operatorToTableAccessMap =
      tableAccessInfo.getOperatorToTableAccessMap();

    // We need a new map to ensure output is always produced in the same order.
    // This makes tests that use this hook deterministic.
    Map<String, String> outputOrderedMap = new HashMap<String, String>();

    for (Map.Entry<Operator<? extends OperatorDesc>, Map<String, List<String>>> tableAccess:
        operatorToTableAccessMap.entrySet()) {
      StringBuilder perOperatorInfo = new StringBuilder();
      perOperatorInfo.append("Operator:").append(tableAccess.getKey().getOperatorId())
        .append("\n");
      for (Map.Entry<String, List<String>> entry: tableAccess.getValue().entrySet()) {
        perOperatorInfo.append("Table:").append(entry.getKey()).append("\n");
        perOperatorInfo.append("Keys:").append(StringUtils.join(entry.getValue(), ','))
          .append("\n");
      }
      outputOrderedMap.put(tableAccess.getKey().getOperatorId(), perOperatorInfo.toString());
    }

    for (String perOperatorInfo: outputOrderedMap.values()) {
        console.printError(perOperatorInfo);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.session.SessionState.LogHelper

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.