use of org.apache.flink.table.types.inference.CallContext in project flink by apache.
the class HiveSimpleUDFTest method init.
protected static HiveSimpleUDF init(Class hiveUdfClass, DataType[] argTypes) {
HiveSimpleUDF udf = new HiveSimpleUDF(new HiveFunctionWrapper(hiveUdfClass.getName()), hiveShim);
// Hive UDF won't have literal args
CallContext callContext = new HiveUDFCallContext(new Object[0], argTypes);
udf.getTypeInference(null).getOutputTypeStrategy().inferType(callContext);
udf.open(null);
return udf;
}
use of org.apache.flink.table.types.inference.CallContext 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.types.inference.CallContext 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"));
}
use of org.apache.flink.table.types.inference.CallContext in project flink by apache.
the class TypeInferenceOperandChecker method checkOperandTypesOrError.
// --------------------------------------------------------------------------------------------
private boolean checkOperandTypesOrError(SqlCallBinding callBinding, CallContext callContext) {
final CallContext adaptedCallContext;
try {
adaptedCallContext = adaptArguments(typeInference, callContext, null);
} catch (ValidationException e) {
throw createInvalidInputException(typeInference, callContext, e);
}
insertImplicitCasts(callBinding, adaptedCallContext.getArgumentDataTypes());
return true;
}
Aggregations