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

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


    @Override
    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
        Object... nodeOutputs) throws SemanticException {
      ExprWalkerInfo ctx = (ExprWalkerInfo) procCtx;
      String alias = null;
      exprNodeFuncDesc expr = (exprNodeFuncDesc) nd;

      UDFType note = expr.getUDFClass().getAnnotation(UDFType.class);
      if(note != null && !note.deterministic()) {
        // this UDF can't be pushed down
        ctx.setIsCandidate(expr, false);
        ctx.setDeterministic(false);
        return false;
      }
     
      boolean isCandidate = true;
      for (int i=0; i < nd.getChildren().size(); i++) {
        exprNodeDesc ch = (exprNodeDesc) nd.getChildren().get(i);
        exprNodeDesc newCh = ctx.getConvertedNode(ch);
        if (newCh != null) {
          expr.getChildExprs().set(i, newCh);
          ch = newCh;
        }
        String chAlias = ctx.getAlias(ch);
       
        isCandidate = isCandidate && ctx.isCandidate(ch);
View Full Code Here


      return mightBeUnknown(d.getDesc()) || mightBeUnknown(d.getIndex());
    } else if (desc instanceof exprNodeFieldDesc) {
      exprNodeFieldDesc d = (exprNodeFieldDesc)desc;
      return mightBeUnknown(d.getDesc());
    } else if (desc instanceof exprNodeFuncDesc) {
      exprNodeFuncDesc d = (exprNodeFuncDesc)desc;
      for(int i=0; i<d.getChildren().size(); i++) {
        if (mightBeUnknown(d.getChildren().get(i))) {
          return true;
        }
      }
      return false;
    } else if (desc instanceof exprNodeColumnDesc) {
View Full Code Here


  private filterDesc getTestFilterDesc(String column) {
    ArrayList<exprNodeDesc> children1 = new ArrayList<exprNodeDesc>();
    children1.add(new exprNodeColumnDesc(TypeInfoFactory.stringTypeInfo, column, "", false));
    exprNodeDesc lhs = new exprNodeFuncDesc(
        Constants.DOUBLE_TYPE_NAME,
        TypeInfoFactory.doubleTypeInfo,
        FunctionRegistry.getUDFClass(Constants.DOUBLE_TYPE_NAME),
        FunctionRegistry.getUDFMethod(Constants.DOUBLE_TYPE_NAME, TypeInfoFactory.stringTypeInfo),
        children1);
   
    ArrayList<exprNodeDesc> children2 = new ArrayList<exprNodeDesc>();
    children2.add(new exprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(100)));
    exprNodeDesc rhs = new exprNodeFuncDesc(
        Constants.DOUBLE_TYPE_NAME,
        TypeInfoFactory.doubleTypeInfo,
        FunctionRegistry.getUDFClass(Constants.DOUBLE_TYPE_NAME),
        FunctionRegistry.getUDFMethod(Constants.DOUBLE_TYPE_NAME, TypeInfoFactory.longTypeInfo),
        children2);
   
    ArrayList<exprNodeDesc> children3 = new ArrayList<exprNodeDesc>();
    children3.add(lhs);
    children3.add(rhs);
   
    exprNodeDesc desc = new exprNodeFuncDesc(
        "<",
        TypeInfoFactory.booleanTypeInfo,
        FunctionRegistry.getUDFClass("<"),
        FunctionRegistry.getUDFMethod("<", TypeInfoFactory.doubleTypeInfo, TypeInfoFactory.doubleTypeInfo),
        children3);
View Full Code Here

        assert(c != null);
       
        // get the conversion method
        ArrayList<exprNodeDesc> conversionArg = new ArrayList<exprNodeDesc>(1);
        conversionArg.add(descPassed);
        newParameters.add(new exprNodeFuncDesc(to.getTypeName(), typeInfoAccepted, c, conv, conversionArg));
      }
    }

    return newParameters;
  }
View Full Code Here

    exprNodeDesc expr = op.getConf().getPredicate();
    LOG.debug(" expr : " + expr.getClass().getName() + " "
        + expr.getExprString());
    if (expr instanceof exprNodeFuncDesc) {
      exprNodeFuncDesc func = (exprNodeFuncDesc) expr;

      String condition = funcSQL(columnsMapping, func);

      if (sqlWhere.length() > 0)
        sqlWhere.append(" AND ");
View Full Code Here

        }
        // group by functions eg. substr(0, 1, 7)

        if (e instanceof exprNodeFuncDesc) {

          exprNodeFuncDesc func = (exprNodeFuncDesc) e;

          String funcSQL = funcSQL(columnsMapping, func);
          String colStr = getColumnFromExpr(func,
              columnsMapping);

          Class<? extends UDF> udfClass = func.getUDFClass();
          FunctionInfo funcInfo = FunctionRegistry
              .getInfo(udfClass);
          String funcName = funcInfo.getDisplayName();
          String funcAlias = funcName + "_" + colStr;
          if (exprAlias != null) {
View Full Code Here

      }

      return colStr;
    }
    else if (e instanceof exprNodeFuncDesc) {
      exprNodeFuncDesc func = (exprNodeFuncDesc) e;
      for (exprNodeDesc c : func.getChildExprs()) {
        if (c instanceof exprNodeColumnDesc) {
          exprNodeColumnDesc col = (exprNodeColumnDesc) c;

          String colStr = columnsMapping.get(col.getColumn());
          if (colStr == null) {
View Full Code Here

TOP

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

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.