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

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


          assert(c != null);

          // get the conversion method
          ArrayList<exprNodeDesc> conversionArg = new ArrayList<exprNodeDesc>(1);
          conversionArg.add(desc);
          ch.add(new exprNodeFuncDesc(
                TypeInfoFactory.getPrimitiveTypeInfo(pType),
                c, m, conversionArg));
        }
      }

      exprNodeFuncDesc desc = new exprNodeFuncDesc(
        TypeInfoFactory.getPrimitiveTypeInfo(udfMethod.getReturnType()),
        FunctionRegistry.getUDFClass(udfName),
        udfMethod, ch);
      return desc;
    }
View Full Code Here


      }
      // UDFOPPositive is a no-op.
      // However, we still create it, and then remove it here, to make sure we only allow
      // "+" for numeric types.
      if (desc instanceof exprNodeFuncDesc) {
        exprNodeFuncDesc funcDesc = (exprNodeFuncDesc)desc;
        if (funcDesc.getUDFClass().equals(UDFOPPositive.class)) {
          assert(funcDesc.getChildren().size() == 1);
          desc = funcDesc.getChildren().get(0);
        }
      }
      assert(desc != null);
      return desc;
    }
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

    @Override
    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
        Object... nodeOutputs) throws SemanticException {

      exprNodeDesc newfd = null;
      exprNodeFuncDesc fd = (exprNodeFuncDesc) nd;

      boolean unknown = false;
      // Check if any of the children is unknown for non logical operators
      if (!fd.getUDFMethod().getDeclaringClass().equals(UDFOPAnd.class)
          && !fd.getUDFMethod().getDeclaringClass().equals(UDFOPOr.class)
          && !fd.getUDFMethod().getDeclaringClass().equals(UDFOPNot.class))
        for(Object child: nodeOutputs) {
          exprNodeDesc child_nd = (exprNodeDesc)child;
          if (child_nd instanceof exprNodeConstantDesc &&
              ((exprNodeConstantDesc)child_nd).getValue() == null) {
            unknown = true;
          }
        }
   
      if (fd.getUDFClass().getAnnotation(UDFType.class) != null &&
          (fd.getUDFClass().getAnnotation(UDFType.class).deterministic() == false ||
           unknown))
        newfd = new exprNodeConstantDesc(fd.getTypeInfo(), null);
      else {
        // Create the list of children
        ArrayList<exprNodeDesc> children = new ArrayList<exprNodeDesc>();
        for(Object child: nodeOutputs) {
          children.add((exprNodeDesc) child);
        }
        // Create a copy of the function descriptor
        newfd = new exprNodeFuncDesc(fd.getMethodName(),
                                     fd.getTypeInfo(), fd.getUDFClass(),
                                     fd.getUDFMethod(), children);       
      }
     
      return newfd;
    }
View Full Code Here

      return false;
    } 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.getChildExprs().get(i))) {
          return true;
        }
      }
      return false;
    } else if (desc instanceof exprNodeGenericFuncDesc) {
      exprNodeGenericFuncDesc d = (exprNodeGenericFuncDesc)desc;
      for(int i=0; i<d.getChildren().size(); i++) {
        if (mightBeUnknown(d.getChildExprs().get(i))) {
          return true;
        }
      }
      return false;
    } else if (desc instanceof exprNodeColumnDesc) {
View Full Code Here

        resultTypeInfo = TypeInfoFactory.getPrimitiveTypeInfoFromPrimitiveWritable(udfMethod.getReturnType());
      } else {
        resultTypeInfo = TypeInfoFactory.getPrimitiveTypeInfoFromJavaPrimitive(udfMethod.getReturnType());
      }
     
      exprNodeFuncDesc desc = new exprNodeFuncDesc(
        udfName,
        resultTypeInfo,
        FunctionRegistry.getUDFClass(udfName),
        udfMethod, ch);
      return desc;
View Full Code Here

      }
      // UDFOPPositive is a no-op.
      // However, we still create it, and then remove it here, to make sure we only allow
      // "+" for numeric types.
      if (desc instanceof exprNodeFuncDesc) {
        exprNodeFuncDesc funcDesc = (exprNodeFuncDesc)desc;
        if (funcDesc.getUDFClass().equals(UDFOPPositive.class)) {
          assert(funcDesc.getChildren().size() == 1);
          desc = funcDesc.getChildExprs().get(0);
        }
      }
      assert(desc != null);
      return desc;
    }
View Full Code Here

      for(; i < preds.size(); i++) {
        List<exprNodeDesc> children = new ArrayList<exprNodeDesc>(2);
        children.add(condn);
        children.add((exprNodeDesc) preds.get(i));
        condn = new exprNodeFuncDesc(
                                     "AND",
                                     TypeInfoFactory.booleanTypeInfo,
                                     FunctionRegistry.getUDFClass("AND"),
                                     FunctionRegistry.getUDFMethod("AND",
                                                                   TypeInfoFactory.booleanTypeInfo,
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.