Search in sources :

Example 1 with DataBuilder

use of org.apache.hadoop.hive.ql.testutil.DataBuilder in project hive by apache.

the class TestGenericUDFRound method getExpectedResult.

@Override
public InspectableObject[] getExpectedResult() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames("_col1", "_col2", "_col3", "_col4", "_col5", "_col6", "_col7", "_col8");
    db.setColumnTypes(PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.writableIntObjectInspector, PrimitiveObjectInspectorFactory.writableDoubleObjectInspector, PrimitiveObjectInspectorFactory.writableFloatObjectInspector, PrimitiveObjectInspectorFactory.writableByteObjectInspector, PrimitiveObjectInspectorFactory.writableShortObjectInspector, PrimitiveObjectInspectorFactory.writableLongObjectInspector, PrimitiveObjectInspectorFactory.writableHiveDecimalObjectInspector);
    db.addRow(null, new IntWritable(170), new DoubleWritable(1.1), new FloatWritable(32f), new ByteWritable((byte) 0), new ShortWritable((short) 1234), new LongWritable(123500L), new HiveDecimalWritable(HiveDecimal.create("983.724")));
    db.addRow(new DoubleWritable(-200), null, null, new FloatWritable(0f), new ByteWritable((byte) 100), new ShortWritable((short) 551), new LongWritable(900L), new HiveDecimalWritable(HiveDecimal.create("983723.005")));
    db.addRow(new DoubleWritable(500), new IntWritable(22345), new DoubleWritable(-23.000), new FloatWritable(-3f), new ByteWritable((byte) 100), new ShortWritable((short) 2321), new LongWritable(9200L), new HiveDecimalWritable(HiveDecimal.create("-932032.7")));
    return db.createRows();
}
Also used : FloatWritable(org.apache.hadoop.io.FloatWritable) DataBuilder(org.apache.hadoop.hive.ql.testutil.DataBuilder) HiveDecimalWritable(org.apache.hadoop.hive.serde2.io.HiveDecimalWritable) DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) LongWritable(org.apache.hadoop.io.LongWritable) ShortWritable(org.apache.hadoop.hive.serde2.io.ShortWritable) ByteWritable(org.apache.hadoop.hive.serde2.io.ByteWritable) IntWritable(org.apache.hadoop.io.IntWritable)

Example 2 with DataBuilder

use of org.apache.hadoop.hive.ql.testutil.DataBuilder in project hive by apache.

the class TestGenericUDFRound method getBaseTable.

@Override
public InspectableObject[] getBaseTable() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames(cols);
    db.setColumnTypes(PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaIntObjectInspector, PrimitiveObjectInspectorFactory.javaDoubleObjectInspector, PrimitiveObjectInspectorFactory.javaFloatObjectInspector, PrimitiveObjectInspectorFactory.javaByteObjectInspector, PrimitiveObjectInspectorFactory.javaShortObjectInspector, PrimitiveObjectInspectorFactory.javaLongObjectInspector, PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(TypeInfoFactory.getDecimalTypeInfo(15, 5)));
    db.addRow("one", 170, Double.valueOf("1.1"), Float.valueOf("32.1234"), Byte.valueOf("25"), Short.valueOf("1234"), 123456L, HiveDecimal.create("983.7235"));
    db.addRow("-234", null, null, Float.valueOf("0.347232"), Byte.valueOf("109"), Short.valueOf("551"), 923L, HiveDecimal.create("983723.005"));
    db.addRow("454.45", 22345, Double.valueOf("-23.00009"), Float.valueOf("-3.4"), Byte.valueOf("76"), Short.valueOf("2321"), 9232L, HiveDecimal.create("-932032.7"));
    return db.createRows();
}
Also used : DataBuilder(org.apache.hadoop.hive.ql.testutil.DataBuilder)

Example 3 with DataBuilder

use of org.apache.hadoop.hive.ql.testutil.DataBuilder in project hive by apache.

the class TestGenericUDFConcat method getExpectedResult.

@Override
public InspectableObject[] getExpectedResult() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames("_col1", "_col2");
    db.setColumnTypes(PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector);
    db.addRow("one", "onetwo");
    db.addRow("four", "fourtwo");
    db.addRow(null, null);
    return db.createRows();
}
Also used : DataBuilder(org.apache.hadoop.hive.ql.testutil.DataBuilder)

Example 4 with DataBuilder

use of org.apache.hadoop.hive.ql.testutil.DataBuilder in project hive by apache.

the class TestGenericUDFConcat method getBaseTable.

@Override
public InspectableObject[] getBaseTable() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames("a", "b", "c");
    db.setColumnTypes(PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector);
    db.addRow("one", "two", "three");
    db.addRow("four", "two", "three");
    db.addRow(null, "two", "three");
    return db.createRows();
}
Also used : DataBuilder(org.apache.hadoop.hive.ql.testutil.DataBuilder)

Aggregations

DataBuilder (org.apache.hadoop.hive.ql.testutil.DataBuilder)4 ByteWritable (org.apache.hadoop.hive.serde2.io.ByteWritable)1 DoubleWritable (org.apache.hadoop.hive.serde2.io.DoubleWritable)1 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)1 ShortWritable (org.apache.hadoop.hive.serde2.io.ShortWritable)1 FloatWritable (org.apache.hadoop.io.FloatWritable)1 IntWritable (org.apache.hadoop.io.IntWritable)1 LongWritable (org.apache.hadoop.io.LongWritable)1