Search in sources :

Example 16 with DoubleWritable

use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.

the class TestUDFMath method testRadians.

@Test
public void testRadians() throws HiveException {
    UDFRadians udf = new UDFRadians();
    input = createDecimal("45.0");
    DoubleWritable res = udf.evaluate(input);
    Assert.assertEquals(0.7853981633974483, res.get(), 0.000001);
}
Also used : DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) Test(org.junit.Test)

Example 17 with DoubleWritable

use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.

the class TestUDFMath method testAsin.

@Test
public void testAsin() throws HiveException {
    UDFAsin udf = new UDFAsin();
    input = createDecimal("0.716");
    DoubleWritable res = udf.evaluate(input);
    Assert.assertEquals(0.7980555152315012, res.get(), 0.000001);
}
Also used : DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) Test(org.junit.Test)

Example 18 with DoubleWritable

use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.

the class TestUDFMath method testLog2.

@Test
public void testLog2() throws HiveException {
    UDFLog2 udf = new UDFLog2();
    input = createDecimal("8.0");
    DoubleWritable res = udf.evaluate(input);
    Assert.assertEquals(3.0, res.get(), 0.000001);
}
Also used : DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) Test(org.junit.Test)

Example 19 with DoubleWritable

use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.

the class TestUDFMath method testCos.

@Test
public void testCos() throws HiveException {
    UDFCos udf = new UDFCos();
    input = createDecimal("0.7727408115633954");
    DoubleWritable res = udf.evaluate(input);
    Assert.assertEquals(0.716, res.get(), 0.000001);
}
Also used : DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) Test(org.junit.Test)

Example 20 with DoubleWritable

use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.

the class TestUDFMath method testDegrees.

@Test
public void testDegrees() throws HiveException {
    UDFDegrees udf = new UDFDegrees();
    input = createDecimal("0.7853981633974483");
    DoubleWritable res = udf.evaluate(input);
    Assert.assertEquals(45.0, res.get(), 0.000001);
}
Also used : DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) Test(org.junit.Test)

Aggregations

DoubleWritable (org.apache.hadoop.hive.serde2.io.DoubleWritable)113 Test (org.junit.Test)61 IntWritable (org.apache.hadoop.io.IntWritable)50 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)49 LongWritable (org.apache.hadoop.io.LongWritable)48 DeferredJavaObject (org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject)42 DeferredObject (org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject)42 Text (org.apache.hadoop.io.Text)42 PrimitiveObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector)40 ShortWritable (org.apache.hadoop.hive.serde2.io.ShortWritable)38 ByteWritable (org.apache.hadoop.hive.serde2.io.ByteWritable)37 FloatWritable (org.apache.hadoop.io.FloatWritable)34 BooleanWritable (org.apache.hadoop.io.BooleanWritable)28 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)24 BytesWritable (org.apache.hadoop.io.BytesWritable)21 ArrayList (java.util.ArrayList)19 HiveVarcharWritable (org.apache.hadoop.hive.serde2.io.HiveVarcharWritable)16 TimestampWritable (org.apache.hadoop.hive.serde2.io.TimestampWritable)15 HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)12 DateWritable (org.apache.hadoop.hive.serde2.io.DateWritable)12