Package org.apache.hadoop.hive.ql.parse

Examples of org.apache.hadoop.hive.ql.parse.VariableSubstitution


  public CommandProcessorResponse run(String command) {


    try {
      SessionState ss = SessionState.get();
      command = new VariableSubstitution().substitute(ss.getConf(),command);

      String[] tokens = command.split("\\s+");
      PrintStream oldOut = System.out;

      if (ss != null && ss.out != null) {
View Full Code Here


    if (varname.startsWith(SetProcessor.ENV_PREFIX)){
      ss.err.println("env:* variables can not be set.");
      return new CommandProcessorResponse(1);
    } else if (varname.startsWith(SetProcessor.SYSTEM_PREFIX)){
      String propName = varname.substring(SetProcessor.SYSTEM_PREFIX.length());
      System.getProperties().setProperty(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue));
      return new CommandProcessorResponse(0);
    } else if (varname.startsWith(SetProcessor.HIVECONF_PREFIX)){
      String propName = varname.substring(SetProcessor.HIVECONF_PREFIX.length());
      try {
        setConf(varname, propName, varvalue, false);
        return new CommandProcessorResponse(0);
      } catch (IllegalArgumentException e) {
        return new CommandProcessorResponse(1, e.getMessage(), "42000");
      }
    } else if (varname.startsWith(SetProcessor.HIVEVAR_PREFIX)) {
      String propName = varname.substring(SetProcessor.HIVEVAR_PREFIX.length());
      ss.getHiveVariables().put(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue));
      return new CommandProcessorResponse(0);
    } else {
      try {
        setConf(varname, varname, varvalue, true);
        return new CommandProcessorResponse(0);
View Full Code Here

  // returns non-null string for validation fail
  private void setConf(String varname, String key, String varvalue, boolean register)
        throws IllegalArgumentException {
    HiveConf conf = SessionState.get().getConf();
    String value = new VariableSubstitution().substitute(conf, varvalue);
    if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)) {
      HiveConf.ConfVars confVars = HiveConf.getConfVars(key);
      if (confVars != null) {
        if (!confVars.isType(value)) {
          StringBuilder message = new StringBuilder();
View Full Code Here

  public void init() {
  }

  public CommandProcessorResponse run(String command) {
    SessionState ss = SessionState.get();
    command = new VariableSubstitution().substitute(ss.getConf(),command);
    String[] tokens = command.split("\\s+");
    SessionState.ResourceType t;
    if (tokens.length < 2
        || (t = SessionState.find_resource_type(tokens[0])) == null) {
      console.printError("Usage: add ["
View Full Code Here

   * @throws CompileProcessorException if the code can not be compiled or the jar can not be made
   */
  @VisibleForTesting
  void parse(SessionState ss) throws CompileProcessorException {
    if (ss != null){
      command = new VariableSubstitution().substitute(ss.getConf(), command);
    }
    if (command == null || command.length() == 0) {
      throw new CompileProcessorException("Command was empty");
    }
    StringBuilder toCompile = new StringBuilder();
View Full Code Here

  public void init() {
  }

  public CommandProcessorResponse run(String command) {
    SessionState ss = SessionState.get();
    command = new VariableSubstitution().substitute(ss.getConf(),command);
    String[] tokens = command.split("\\s+");

    SessionState.ResourceType t;
    if (tokens.length < 1
        || (t = SessionState.find_resource_type(tokens[0])) == null) {
View Full Code Here

      TaskFactory.resetId();
    }
    saveSession(queryState);

    try {
      command = new VariableSubstitution().substitute(conf,command);
      ctx = new Context(conf);
      ctx.setTryCount(getTryCount());
      ctx.setCmd(command);
      ctx.setHDFSCleanup(true);
View Full Code Here

    }

    TaskFactory.resetId();

    try {
      command = new VariableSubstitution().substitute(conf,command);
      ctx = new Context(conf);

      ParseDriver pd = new ParseDriver();
      ASTNode tree = pd.parse(command, ctx);
      tree = ParseUtils.findRootNonNullToken(tree);
View Full Code Here

    if (varname.startsWith(SetProcessor.ENV_PREFIX)){
      ss.err.println("env:* variables can not be set.");
      return new CommandProcessorResponse(1);
    } else if (varname.startsWith(SetProcessor.SYSTEM_PREFIX)){
      String propName = varname.substring(SetProcessor.SYSTEM_PREFIX.length());
      System.getProperties().setProperty(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue));
      return new CommandProcessorResponse(0);
    } else if (varname.startsWith(SetProcessor.HIVECONF_PREFIX)){
      String propName = varname.substring(SetProcessor.HIVECONF_PREFIX.length());
      ss.getConf().set(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue));
      return new CommandProcessorResponse(0);
    } else {
      ss.getConf().set(varname, new VariableSubstitution().substitute(ss.getConf(),varvalue) );
      return new CommandProcessorResponse(0);
    }
  }
View Full Code Here

  public void init() {
  }

  public CommandProcessorResponse run(String command) {
    SessionState ss = SessionState.get();
    command = new VariableSubstitution().substitute(ss.getConf(),command);
    String[] tokens = command.split("\\s+");
    SessionState.ResourceType t;
    if (tokens.length < 2
        || (t = SessionState.find_resource_type(tokens[0])) == null) {
      console.printError("Usage: add ["
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.parse.VariableSubstitution

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.