use of org.apache.flink.table.functions.hive.HiveSimpleUDFTest.HiveUDFCallContext in project flink by apache.
the class HiveGenericUDFTest method init.
private static HiveGenericUDF init(Class hiveUdfClass, Object[] constantArgs, DataType[] argTypes) {
HiveGenericUDF udf = new HiveGenericUDF(new HiveFunctionWrapper(hiveUdfClass.getName()), hiveShim);
CallContext callContext = new HiveUDFCallContext(constantArgs, argTypes);
udf.getTypeInference(null).getOutputTypeStrategy().inferType(callContext);
udf.open(null);
return udf;
}
use of org.apache.flink.table.functions.hive.HiveSimpleUDFTest.HiveUDFCallContext in project flink by apache.
the class HiveModuleTest method testHiveBuiltInFunction.
@Test
public void testHiveBuiltInFunction() {
FunctionDefinition fd = new HiveModule().getFunctionDefinition("reverse").get();
HiveSimpleUDF udf = (HiveSimpleUDF) fd;
DataType[] inputType = new DataType[] { DataTypes.STRING() };
CallContext callContext = new HiveUDFCallContext(new Object[0], inputType);
udf.getTypeInference(null).getOutputTypeStrategy().inferType(callContext);
udf.open(null);
assertEquals("cba", udf.eval("abc"));
}
Aggregations