Package org.apache.hadoop.hive.ql.udf.generic.GenericUDF

Examples of org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject


    DoubleWritable input = new DoubleWritable(32300.004747);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableDoubleObjectInspector,
    };
    DeferredObject[] args = {
        new DeferredJavaObject(input)
    };

    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
    Assert.assertEquals(TypeInfoFactory.longTypeInfo, oi.getTypeInfo());
    LongWritable res = (LongWritable) udf.evaluate(args);
View Full Code Here


    DecimalTypeInfo inputTypeInfo = TypeInfoFactory.getDecimalTypeInfo(11, 6);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
        new DeferredJavaObject(input)
    };

    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
    Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(6, 0), oi.getTypeInfo());
    HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
View Full Code Here

    Text input = new Text("32300.004747");
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableStringObjectInspector,
    };
    DeferredObject[] args = {
        new DeferredJavaObject(input)
    };

    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
    Assert.assertEquals(TypeInfoFactory.longTypeInfo, oi.getTypeInfo());
    LongWritable res = (LongWritable) udf.evaluate(args);
View Full Code Here

    VarcharTypeInfo inputTypeInfo = TypeInfoFactory.getVarcharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
        new DeferredJavaObject(input)
    };

    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
    Assert.assertEquals(TypeInfoFactory.longTypeInfo, oi.getTypeInfo());
    LongWritable res = (LongWritable) udf.evaluate(args);
View Full Code Here

    CharTypeInfo inputTypeInfo = TypeInfoFactory.getCharTypeInfo(12);
    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(inputTypeInfo),
    };
    DeferredObject[] args = {
        new DeferredJavaObject(input)
    };

    PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
    Assert.assertEquals(TypeInfoFactory.longTypeInfo, oi.getTypeInfo());
    LongWritable res = (LongWritable) udf.evaluate(args);
View Full Code Here

    runAndVerify("hi", 1, "??", "h", udf);
  }

  private void runAndVerify(String str, int len, String pad, String expResult, GenericUDF udf)
      throws HiveException {
    DeferredObject valueObj1 = new DeferredJavaObject(new Text(str));
    DeferredObject valueObj2 = new DeferredJavaObject(new IntWritable(len));
    DeferredObject valueObj3 = new DeferredJavaObject(new Text(pad));
    DeferredObject[] args = { valueObj1, valueObj2, valueObj3 };
    Text output = (Text) udf.evaluate(args);
    assertEquals("lpad() test ", expResult, output.toString());
  }
View Full Code Here

    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableByteObjectInspector,
        PrimitiveObjectInspectorFactory.writableByteObjectInspector
    };
    DeferredObject[] args = {
        new DeferredJavaObject(b1),
        new DeferredJavaObject(b2),
    };

    udf.initialize(inputOIs);
    ByteWritable b3 = (ByteWritable) udf.evaluate(args);
    Assert.assertNull(b3);
View Full Code Here

    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableShortObjectInspector,
        PrimitiveObjectInspectorFactory.writableShortObjectInspector
    };
    DeferredObject[] args = {
        new DeferredJavaObject(s1),
        new DeferredJavaObject(s2),
    };

    udf.initialize(inputOIs);
    ShortWritable s3 = (ShortWritable) udf.evaluate(args);
    Assert.assertNull(s3);
View Full Code Here

    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableIntObjectInspector,
        PrimitiveObjectInspectorFactory.writableIntObjectInspector
    };
    DeferredObject[] args = {
        new DeferredJavaObject(i1),
        new DeferredJavaObject(i2),
    };

    udf.initialize(inputOIs);
    IntWritable i3 = (IntWritable) udf.evaluate(args);
    Assert.assertNull(i3);
View Full Code Here

    ObjectInspector[] inputOIs = {
        PrimitiveObjectInspectorFactory.writableLongObjectInspector,
        PrimitiveObjectInspectorFactory.writableLongObjectInspector
    };
    DeferredObject[] args = {
        new DeferredJavaObject(l1),
        new DeferredJavaObject(l2),
    };

    udf.initialize(inputOIs);
    LongWritable l3 = (LongWritable) udf.evaluate(args);
    Assert.assertNull(l3);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject

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.