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);
}
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);
}
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());
}
}
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());
}
}
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);
}
Aggregations