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

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


  }

  public MapredLocalTask(MapredLocalWork plan, JobConf job, boolean isSilent) throws HiveException {
    setWork(plan);
    this.job = job;
    console = new LogHelper(LOG, isSilent);
  }
View Full Code Here


      case Task.LOCAL_MAPJOIN:
         localMapJoin++;
         break;
      }
    }
    LogHelper console = SessionState.getConsole();
    console.printError("[MapJoinCounter PostHook] CONVERTED_LOCAL_MAPJOIN: " + convertedLocalMapJoin
        + " CONVERTED_MAPJOIN: " + convertedMapJoin + " LOCAL_MAPJOIN: "+localMapJoin+ " COMMON_JOIN: "+commonJoin
        + " BACKUP_COMMON_JOIN: " + backupCommonJoin);
  }
View Full Code Here

  public CliDriver() {
    SessionState ss = SessionState.get();
    conf = (ss != null) ? ss.getConf() : new Configuration();
    Log LOG = LogFactory.getLog("CliDriver");
    console = new LogHelper(LOG);
  }
View Full Code Here

* traces were or were not collected.
*/
public class VerifySessionStateStackTracesHook implements ExecuteWithHookContext {

  public void run(HookContext hookContext) {
    LogHelper console = SessionState.getConsole();

    for (Entry<String, List<List<String>>> entry :
        SessionState.get().getStackTraces().entrySet()) {

      for (List<String> stackTrace : entry.getValue()) {
        // Only print the first line of the stack trace as it contains the error message, and other
        // lines may contain line numbers which are volatile
        // Also only take the string after the first two spaces, because the prefix is a date and
        // and time stamp
        console.printError(StringUtils.substringAfter(
            StringUtils.substringAfter(stackTrace.get(0), " "), " "));
      }
    }
  }
View Full Code Here

* in the HookContext passed to the hook.
*/
public class CheckQueryPropertiesHook implements ExecuteWithHookContext {

  public void run(HookContext hookContext) {
    LogHelper console = SessionState.getConsole();

    if (console == null) {
      return;
    }

    QueryProperties queryProps = hookContext.getQueryPlan().getQueryProperties();

    if (queryProps != null) {
      console.printError("Has Join: " + queryProps.hasJoin());
      console.printError("Has Group By: " + queryProps.hasGroupBy());
      console.printError("Has Sort By: " + queryProps.hasSortBy());
      console.printError("Has Order By: " + queryProps.hasOrderBy());
      console.printError("Has Group By After Join: " + queryProps.hasJoinFollowedByGroupBy());
      console.printError("Uses Script: " + queryProps.usesScript());
      console.printError("Has Distribute By: " + queryProps.hasDistributeBy());
      console.printError("Has Cluster By: " + queryProps.hasClusterBy());
    }
  }
View Full Code Here

    ColumnAccessInfo columnAccessInfo = hookContext.getQueryPlan().getColumnAccessInfo();
    if (columnAccessInfo == null) {
      return;
    }

    LogHelper console = SessionState.getConsole();
    Map<String, Set<String>> tableToColumnAccessMap =
      columnAccessInfo.getTableToColumnAccessMap();

    // 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<String, Set<String>> tableAccess : tableToColumnAccessMap.entrySet()) {
      StringBuilder perTableInfo = new StringBuilder();
      perTableInfo.append("Table:").append(tableAccess.getKey()).append("\n");
      // Sort columns to make output deterministic
      String[] columns = new String[tableAccess.getValue().size()];
      tableAccess.getValue().toArray(columns);
      Arrays.sort(columns);
      perTableInfo.append("Columns:").append(StringUtils.join(columns, ','))
        .append("\n");
      outputOrderedMap.put(tableAccess.getKey(), perTableInfo.toString());
    }

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

  private static boolean driverRunPreHookFirstRan = false;
  private static boolean driverRunPostHookFirstRan = false;

  public static class RunFirst implements ExecuteWithHookContext {
    public void run(HookContext hookContext) {
      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 " + hookContext.getHookType());

      if (hookContext.getHookType() == HookType.PRE_EXEC_HOOK) {
        preHookRunFirstRan = true;
      } else {
        postHookRunFirstRan = true;
View Full Code Here

    }
  }

  public static class RunSecond implements ExecuteWithHookContext {
    public void run(HookContext 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 " + hookContext.getHookType());

      if (hookContext.getHookType() == HookType.PRE_EXEC_HOOK) {
        Assert.assertTrue("Pre hooks did not run in the order specified.", preHookRunFirstRan);
      } else {
        Assert.assertTrue("Post hooks did not run in the order specified.", postHookRunFirstRan);
View Full Code Here

  public static class RunFirstSemanticAnalysisHook 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 RunFirst for Pre Analysis Hook");

      staticAnalysisPreHookFirstRan = true;

      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 RunFirst for Post Analysis Hook");

      staticAnalysisPostHookFirstRan = true;
    }
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.