Search in sources :

Example 6 with TypeInfoFactory.binaryTypeInfo

use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.binaryTypeInfo in project hive by apache.

the class TestGenericUDFAesDecrypt method testAesDec128ConstBin.

@Test
public void testAesDec128ConstBin() throws HiveException {
    GenericUDFAesDecrypt udf = new GenericUDFAesDecrypt();
    ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
    BytesWritable keyWr = new BytesWritable("1234567890123456".getBytes());
    ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.binaryTypeInfo, keyWr);
    ObjectInspector[] arguments = { valueOI0, valueOI1 };
    udf.initialize(arguments);
    runAndVerifyBin("y6Ss+zCYObpCbgfWfyNWTw==", keyWr, "ABC", udf);
    runAndVerifyBin("BQGHoM3lqYcsurCRq3PlUw==", keyWr, "", udf);
    // null
    runAndVerifyBin(null, keyWr, null, udf);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) BytesWritable(org.apache.hadoop.io.BytesWritable) Test(org.junit.Test)

Example 7 with TypeInfoFactory.binaryTypeInfo

use of org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.binaryTypeInfo in project hive by apache.

the class TestGenericUDFAesEncrypt method testAesEncKeyNullConstBin.

@Test
public void testAesEncKeyNullConstBin() throws HiveException {
    GenericUDFAesEncrypt udf = new GenericUDFAesEncrypt();
    ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
    BytesWritable keyWr = null;
    ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(TypeInfoFactory.binaryTypeInfo, keyWr);
    ObjectInspector[] arguments = { valueOI0, valueOI1 };
    udf.initialize(arguments);
    runAndVerifyBin(new byte[] { 65, 66, 67 }, keyWr, null, udf);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) BytesWritable(org.apache.hadoop.io.BytesWritable) Test(org.junit.Test)

Aggregations

ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)6 BytesWritable (org.apache.hadoop.io.BytesWritable)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Table (org.apache.hadoop.hive.ql.metadata.Table)2 SemanticException (org.apache.hadoop.hive.ql.parse.SemanticException)2 GenericUDAFBloomFilterEvaluator (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFBloomFilter.GenericUDAFBloomFilterEvaluator)2 LinkedHashMap (java.util.LinkedHashMap)1 ColumnInfo (org.apache.hadoop.hive.ql.exec.ColumnInfo)1 GroupByOperator (org.apache.hadoop.hive.ql.exec.GroupByOperator)1 ReduceSinkOperator (org.apache.hadoop.hive.ql.exec.ReduceSinkOperator)1 RowSchema (org.apache.hadoop.hive.ql.exec.RowSchema)1 SelectOperator (org.apache.hadoop.hive.ql.exec.SelectOperator)1 TableScanOperator (org.apache.hadoop.hive.ql.exec.TableScanOperator)1 RuntimeValuesInfo (org.apache.hadoop.hive.ql.parse.RuntimeValuesInfo)1 SemiJoinHint (org.apache.hadoop.hive.ql.parse.SemiJoinHint)1 AggregationDesc (org.apache.hadoop.hive.ql.plan.AggregationDesc)1 ExprNodeColumnDesc (org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1