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

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


    " If str is NULL, the return value is 0."
    )
public class GenericUDFField extends GenericUDF {
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
    if (arguments.length < 2) {
      throw new UDFArgumentException("The function FIELD(str, str1, str2, ...) needs at least two arguments.");
    }
   
    for (int i = 0; i < arguments.length; i++) {
      Category category = arguments[i].getCategory();
      if (category != Category.PRIMITIVE) {
View Full Code Here


  @Override
  public StructObjectInspector initialize(ObjectInspector [] args)
  throws UDFArgumentException {
   
    if (args.length != 1) {
      throw new UDFArgumentException("explode() takes only one argument");
    }
   
    if (args[0].getCategory() != ObjectInspector.Category.LIST) {
      throw new UDFArgumentException("explode() takes an array as a parameter");
    }
    listOI = (ListObjectInspector)args[0];
   
    ArrayList<String> fieldNames = new ArrayList<String>();
    ArrayList<ObjectInspector> fieldOIs = new ArrayList<ObjectInspector>();
View Full Code Here

  @Override
  public StructObjectInspector initialize(ObjectInspector [] args)
  throws UDFArgumentException {
   
    if (args.length != 1) {
      throw new UDFArgumentException("explode() takes only one argument");
    }
   
    if (args[0].getCategory() != ObjectInspector.Category.LIST) {
      throw new UDFArgumentException("explode() takes an array as a parameter");
    }
    listOI = (ListObjectInspector)args[0];
   
    ArrayList<String> fieldNames = new ArrayList<String>();
    ArrayList<ObjectInspector> fieldOIs = new ArrayList<ObjectInspector>();
View Full Code Here

    public static ExprNodeDesc getFuncExprNodeDesc(String udfName,
        ExprNodeDesc... children) throws UDFArgumentException {

      FunctionInfo fi = FunctionRegistry.getFunctionInfo(udfName);
      if (fi == null) {
        throw new UDFArgumentException(udfName + " not found.");
      }

      GenericUDF genericUDF = fi.getGenericUDF();
      if (genericUDF == null) {
        throw new UDFArgumentException(udfName
            + " is an aggregation function or a table function.");
      }

      List<ExprNodeDesc> childrenList = new ArrayList<ExprNodeDesc>(children.length);
      childrenList.addAll(Arrays.asList(children));
View Full Code Here

  @Override
  public StructObjectInspector initialize(ObjectInspector[] args)
      throws UDFArgumentException {

    if (args.length != 1) {
      throw new UDFArgumentException("explode() takes only one argument");
    }

    if (args[0].getCategory() != ObjectInspector.Category.LIST) {
      throw new UDFArgumentException("explode() takes an array as a parameter");
    }
    listOI = (ListObjectInspector) args[0];

    ArrayList<String> fieldNames = new ArrayList<String>();
    ArrayList<ObjectInspector> fieldOIs = new ArrayList<ObjectInspector>();
View Full Code Here

    public static ExprNodeDesc getFuncExprNodeDesc(String udfName,
        ExprNodeDesc... children) throws UDFArgumentException {

      FunctionInfo fi = FunctionRegistry.getFunctionInfo(udfName);
      if (fi == null) {
        throw new UDFArgumentException(udfName + " not found.");
      }

      GenericUDF genericUDF = fi.getGenericUDF();
      if (genericUDF == null) {
        throw new UDFArgumentException(udfName
            + " is an aggregation function or a table function.");
      }

      List<ExprNodeDesc> childrenList = new ArrayList<ExprNodeDesc>(children.length);
      childrenList.addAll(Arrays.asList(children));
View Full Code Here

          + arguments.length);
    }
    try {
      argumentOI = (PrimitiveObjectInspector) arguments[0];
    } catch (ClassCastException e) {
      throw new UDFArgumentException(
          "The function BINARY takes only primitive types");
    }

    if (!((argumentOI instanceof BinaryObjectInspector)
        || (argumentOI instanceof StringObjectInspector)
        || (argumentOI instanceof VoidObjectInspector))){
      throw new UDFArgumentException("Only string or binary data can be cast into binary " +
          "data types.");
    }
    baConverter = new BinaryConverter(argumentOI,
        PrimitiveObjectInspectorFactory.writableBinaryObjectInspector);
    return PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
View Full Code Here

    inputOIs = args;
    numCols = args.length - 1;

    if (numCols < 1) {
      throw new UDFArgumentException("parse_url_tuple() takes at least two arguments: " +
          "the url string and a part name");
    }

    for (int i = 0; i < args.length; ++i) {
      if (args[i].getCategory() != ObjectInspector.Category.PRIMITIVE ||
          !args[i].getTypeName().equals(Constants.STRING_TYPE_NAME)) {
        throw new UDFArgumentException("parse_url_tuple()'s arguments have to be string type");
      }
    }

    seenErrors = false;
    pathParsed = false;
View Full Code Here

  @Override
  public ObjectInspector initialize(ObjectInspector[] arguments)
      throws UDFArgumentException {
    if (arguments.length < 2) {
      throw new UDFArgumentException(
          "The function FIELD(str, str1, str2, ...) needs at least two arguments.");
    }

    argumentOIs = arguments;
View Full Code Here

  @Override
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {

    if (arguments.length != 2) {
      throw new UDFArgumentException(
          opName + " requires two arguments.");
    }

    argumentOIs = arguments;
View Full Code Here

TOP

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

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.