Package org.apache.hadoop.hive.ql.exec

Examples of org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException


  public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters)
      throws SemanticException
  {
    if (parameters.length > 2)
    {
      throw new UDFArgumentTypeException(2, "At most 2 arguments expected");
    }
    if ( parameters.length > 1 && !parameters[1].equals(TypeInfoFactory.booleanTypeInfo) )
    {
      throw new UDFArgumentTypeException(1, "second argument must be a boolean expression");
    }
    return createEvaluator();
  }
View Full Code Here


  @Override
  public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters) throws SemanticException
  {
    if (parameters.length != 1)
    {
      throw new UDFArgumentTypeException(parameters.length - 1, "Exactly one argument is expected.");
    }
    ObjectInspector oi = TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(parameters[0]);
   
    boolean c = ObjectInspectorUtils.compareTypes(oi, PrimitiveObjectInspectorFactory.writableIntObjectInspector);
    if (!c)
    {
      throw new UDFArgumentTypeException(0, "Number of tiles must be an int expression");
    }
   
    return new GenericUDAFNTileEvaluator();
  }
View Full Code Here

  @Override
  public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters) throws SemanticException
  {
    if (parameters.length < 1)
    {
      throw new UDFArgumentTypeException(parameters.length - 1, "One or more arguments are expected.");
    }
    for(int i=0; i<parameters.length; i++)
    {
      ObjectInspector oi = TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(parameters[i]);
      if (!ObjectInspectorUtils.compareSupported(oi))
      {
        throw new UDFArgumentTypeException(i,
          "Cannot support comparison of map<> type or complex type containing map<>.");
      }
    }
    return createEvaluator();
  }
View Full Code Here

  @Override
  public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters) throws SemanticException
  {
    if (parameters.length > 2)
    {
      throw new UDFArgumentTypeException(2, "At most 2 arguments expected");
    }
    if ( parameters.length > 1 && !parameters[1].equals(TypeInfoFactory.booleanTypeInfo) )
    {
      throw new UDFArgumentTypeException(1, "second argument must be a boolean expression");
    }
    return createEvaluator();
  }
View Full Code Here

  public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters)
      throws SemanticException
  {
    if (parameters.length != 0)
    {
      throw new UDFArgumentTypeException(parameters.length - 1,
          "No argument is expected.");
    }
    return new GenericUDAFRowNumberEvaluator();
  }
View Full Code Here

    {
      amtOI = (PrimitiveObjectInspector) arguments[1];
    }
    else
    {
      throw new UDFArgumentTypeException(1,
          "Primitive Type is expected but "
              + arguments[1].getTypeName() + "\" is found");
    }
     
    firstArgOI = arguments[0];
View Full Code Here

      throw new UDFArgumentLengthException("The function trunc(date, format) needs at least one argument.");
    }

    for (int i = 0; i < arguments.length; i++) {
      if (arguments[i].getTypeName() != Constants.STRING_TYPE_NAME) {
        throw new UDFArgumentTypeException(i, "Only String type arguments are accepted but "
            + arguments[i].getTypeName() + " is passed.");
      }
    }

    argumentIOs = arguments;
View Full Code Here

          + "at least three arguments.");
    }

    for (int i = 0; i < arguments.length; i++) {
      if (arguments[i].getCategory() != ObjectInspector.Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(i, "Only primitive type arguments are accepted but "
            + arguments[i].getTypeName() + " is passed.");
      }
    }

    argumentOIs = arguments;
    returnOIResolver = new GenericUDFUtils.ReturnObjectInspectorResolver(true);
    for (int i = 0; i < arguments.length; i++) {
      if (!returnOIResolver.update(arguments[i])) {
        throw new UDFArgumentTypeException(i, "The value of return should have the same type: \""
            + returnOIResolver.get().getTypeName() + "\" is expected but \""
            + arguments[i].getTypeName()
            + "\" is found");
      }
    }
View Full Code Here

      throw new UDFArgumentException("Exactly two argument is expected.");
    }

    for(int i=0;i<arguments.length;i++){
      if (arguments[i].getCategory() != ObjectInspector.Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(i,
            "Only primitive type arguments are accepted but "
            + arguments[i].getTypeName() + " is passed.");
      }
    }

    String t = arguments[1].getTypeName();
    if (t.equals(Constants.TINYINT_TYPE_NAME)||
        t.equals(Constants.SMALLINT_TYPE_NAME)||
        t.equals(Constants.INT_TYPE_NAME)||
        t.equals(Constants.BIGINT_TYPE_NAME)) {
      resultOI = PrimitiveObjectInspectorFactory.writableLongObjectInspector;
    } else if (t.equals(Constants.FLOAT_TYPE_NAME)||
        t.equals(Constants.DOUBLE_TYPE_NAME)||
        t.equals(Constants.STRING_TYPE_NAME)) {
      resultOI = PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
    } else{
      throw new UDFArgumentTypeException(1,
          "Only numeric or string type arguments are accepted but "
          + arguments[1].getTypeName() + " is passed.");
    }

    longResult.set(0);
View Full Code Here

    for (int i = 0; i < 4; i++) {
      if (arguments[i].getCategory() == ObjectInspector.Category.PRIMITIVE) {
        PrimitiveObjectInspector poi = ((PrimitiveObjectInspector) arguments[i]);

        if (!(poi.getPrimitiveCategory() == PrimitiveObjectInspector.PrimitiveCategory.STRING)) {
          throw new UDFArgumentTypeException(i,
              "The argument of function  should be \""
              + serdeConstants.STRING_TYPE_NAME + "\", but \""
              + arguments[i].getTypeName() + "\" is found");
        }
      }
    }
    for (int i = 4; i < arguments.length; i++) {
      if (arguments[i].getCategory() != ObjectInspector.Category.PRIMITIVE) {
        throw new UDFArgumentTypeException(i,
            "The argument of function should be primative" + ", but \""
            + arguments[i].getTypeName() + "\" is found");
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException

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.