Search in sources :

Example 26 with BooleanWritable

use of org.apache.hadoop.io.BooleanWritable in project crunch by cloudera.

the class WritablesTest method testBoolean.

@Test
public void testBoolean() throws Exception {
    boolean j = false;
    BooleanWritable w = new BooleanWritable(j);
    testInputOutputFn(Writables.booleans(), j, w);
}
Also used : BooleanWritable(org.apache.hadoop.io.BooleanWritable) Test(org.junit.Test)

Example 27 with BooleanWritable

use of org.apache.hadoop.io.BooleanWritable in project goldenorb by jzachr.

the class SampleBooleanMessageTest method testRPC.

@Test
public void testRPC() {
    BooleanMessage bm1 = client.sendAndReceiveMessage(bm0, DESTINATION_VALUE, new BooleanWritable(MESSAGE_VALUE));
    assertEquals(bm0.get(), client.getMessage().get());
    assertEquals(bm0.getDestinationVertex(), client.getMessage().getDestinationVertex());
    assertEquals(bm1.getDestinationVertex(), DESTINATION_VALUE);
    assertEquals(((BooleanWritable) bm1.getMessageValue()).get(), MESSAGE_VALUE);
}
Also used : BooleanMessage(org.goldenorb.types.message.BooleanMessage) BooleanWritable(org.apache.hadoop.io.BooleanWritable) Test(org.junit.Test)

Example 28 with BooleanWritable

use of org.apache.hadoop.io.BooleanWritable in project hive by apache.

the class TestGenericUDFRegexp method runAndVerify.

private void runAndVerify(String str, String regex, Boolean expResult, GenericUDF udf) throws HiveException {
    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new Text(str) : null);
    DeferredObject valueObj1 = new DeferredJavaObject(regex != null ? new Text(regex) : null);
    DeferredObject[] args = { valueObj0, valueObj1 };
    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
    if (expResult == null) {
        assertNull(output);
    } else {
        assertNotNull(output);
        assertEquals("regexp() test ", expResult.booleanValue(), output.get());
    }
}
Also used : DeferredJavaObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject) BooleanWritable(org.apache.hadoop.io.BooleanWritable) DeferredObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject) Text(org.apache.hadoop.io.Text)

Example 29 with BooleanWritable

use of org.apache.hadoop.io.BooleanWritable in project hive by apache.

the class TestGenericUDFRegexp method runAndVerifyConst.

private void runAndVerifyConst(String str, Text regexText, Boolean expResult, GenericUDF udf) throws HiveException {
    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new Text(str) : null);
    DeferredObject valueObj1 = new DeferredJavaObject(regexText);
    DeferredObject[] args = { valueObj0, valueObj1 };
    BooleanWritable output = (BooleanWritable) udf.evaluate(args);
    if (expResult == null) {
        assertNull(output);
    } else {
        assertNotNull(output);
        assertEquals("regexp() const test ", expResult.booleanValue(), output.get());
    }
}
Also used : DeferredJavaObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject) BooleanWritable(org.apache.hadoop.io.BooleanWritable) DeferredObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject) Text(org.apache.hadoop.io.Text)

Example 30 with BooleanWritable

use of org.apache.hadoop.io.BooleanWritable in project hive by apache.

the class TestGenericUDFMonthsBetween method testMonthsBetweenForDate.

public void testMonthsBetweenForDate() throws HiveException {
    GenericUDFMonthsBetween udf = new GenericUDFMonthsBetween();
    ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableDateObjectInspector;
    ObjectInspector valueOI2 = PrimitiveObjectInspectorFactory.writableDateObjectInspector;
    ObjectInspector[] arguments = { valueOI1, valueOI2 };
    udf.initialize(arguments);
    testMonthsBetweenForDate(udf);
    // Run without round-off
    GenericUDFMonthsBetween udfWithoutRoundOff = new GenericUDFMonthsBetween();
    ObjectInspector vOI1 = PrimitiveObjectInspectorFactory.writableDateObjectInspector;
    ObjectInspector vOI2 = PrimitiveObjectInspectorFactory.writableDateObjectInspector;
    ObjectInspector vOI3 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.booleanTypeInfo, new BooleanWritable(false));
    ObjectInspector[] args = { vOI1, vOI2, vOI3 };
    udfWithoutRoundOff.initialize(args);
    testMonthsBetweenForDate(udfWithoutRoundOff);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) BooleanWritable(org.apache.hadoop.io.BooleanWritable)

Aggregations

BooleanWritable (org.apache.hadoop.io.BooleanWritable)63 IntWritable (org.apache.hadoop.io.IntWritable)41 LongWritable (org.apache.hadoop.io.LongWritable)40 FloatWritable (org.apache.hadoop.io.FloatWritable)37 Text (org.apache.hadoop.io.Text)31 DoubleWritable (org.apache.hadoop.hive.serde2.io.DoubleWritable)27 ShortWritable (org.apache.hadoop.hive.serde2.io.ShortWritable)26 BytesWritable (org.apache.hadoop.io.BytesWritable)26 ByteWritable (org.apache.hadoop.hive.serde2.io.ByteWritable)25 Writable (org.apache.hadoop.io.Writable)17 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)15 Configuration (org.apache.hadoop.conf.Configuration)12 TimestampWritable (org.apache.hadoop.hive.serde2.io.TimestampWritable)12 Random (java.util.Random)11 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)10 DateWritable (org.apache.hadoop.hive.serde2.io.DateWritable)9 KeyValue (org.apache.hadoop.hbase.KeyValue)7 Result (org.apache.hadoop.hbase.client.Result)7 HiveChar (org.apache.hadoop.hive.common.type.HiveChar)7