use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.stringTypeInfo in project hive by apache.
the class TestGenericUDFAesDecrypt method testAesDecKeyNullConstStr.
@Test
public void testAesDecKeyNullConstStr() throws HiveException {
GenericUDFAesDecrypt udf = new GenericUDFAesDecrypt();
ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
Text keyWr = null;
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.stringTypeInfo, keyWr);
ObjectInspector[] arguments = { valueOI0, valueOI1 };
udf.initialize(arguments);
runAndVerifyStr("y6Ss+zCYObpCbgfWfyNWTw==", keyWr, null, udf);
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.stringTypeInfo in project hive by apache.
the class TestGenericUDFDateFormat method testDateFormatTs.
@Test
public void testDateFormatTs() throws HiveException {
GenericUDFDateFormat udf = new GenericUDFDateFormat();
ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableTimestampObjectInspector;
Text fmtText = new Text("EEEE");
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.stringTypeInfo, fmtText);
ObjectInspector[] arguments = { valueOI0, valueOI1 };
udf.initialize(arguments);
runAndVerifyTs("2015-04-08 10:30:45", fmtText, "Wednesday", udf);
runAndVerifyTs("2015-04-05 10:30:45", fmtText, "Sunday", udf);
runAndVerifyTs("2015-04-06 10:30:45", fmtText, "Monday", udf);
runAndVerifyTs("2015-04-07 10:30:45", fmtText, "Tuesday", udf);
runAndVerifyTs("2015-04-08 10:30:45", fmtText, "Wednesday", udf);
runAndVerifyTs("2015-04-09 10:30:45", fmtText, "Thursday", udf);
runAndVerifyTs("2015-04-10 10:30:45.123", fmtText, "Friday", udf);
runAndVerifyTs("2015-04-11 10:30:45.123456789", fmtText, "Saturday", udf);
runAndVerifyTs("2015-04-12 10:30:45", fmtText, "Sunday", udf);
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.stringTypeInfo in project hive by apache.
the class TestGenericUDFDateFormat method testDateFormatTsWithTimeZone.
@Test
public void testDateFormatTsWithTimeZone() throws HiveException {
GenericUDFDateFormat udf = new GenericUDFDateFormat();
ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableTimestampObjectInspector;
Text fmtText = new Text("yyyy-MM-dd HH:mm:ss.SSS z");
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.stringTypeInfo, fmtText);
ObjectInspector[] arguments = { valueOI0, valueOI1 };
udf.initialize(arguments);
runAndVerifyTs("2015-04-08 10:30:45", fmtText, "2015-04-08 10:30:45.000 PDT", udf);
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.stringTypeInfo in project hive by apache.
the class TestGenericUDFDateFormat method testWrongFmt.
@Test
public void testWrongFmt() throws HiveException {
GenericUDFDateFormat udf = new GenericUDFDateFormat();
ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
Text fmtText = new Text("B");
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.stringTypeInfo, fmtText);
ObjectInspector[] arguments = { valueOI0, valueOI1 };
udf.initialize(arguments);
runAndVerifyStr("2015-04-05", fmtText, null, udf);
}
use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.stringTypeInfo in project hive by apache.
the class TestGenericUDFDateFormat method testNullFmt.
@Test
public void testNullFmt() throws HiveException {
GenericUDFDateFormat udf = new GenericUDFDateFormat();
ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
Text fmtText = null;
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.stringTypeInfo, fmtText);
ObjectInspector[] arguments = { valueOI0, valueOI1 };
udf.initialize(arguments);
runAndVerifyStr("2015-04-05", fmtText, null, udf);
}
Aggregations