use of org.apache.flink.table.functions.FunctionContext in project flink by apache.
the class HiveGenericUDTF method open.
@Override
public void open(FunctionContext context) throws Exception {
function = hiveFunctionWrapper.createFunction();
function.setCollector(input -> {
Row row = (Row) HiveInspectors.toFlinkObject(returnInspector, input, hiveShim);
HiveGenericUDTF.this.collect(row);
});
ObjectInspector[] argumentInspectors = HiveInspectors.toInspectors(hiveShim, constantArguments, argTypes);
returnInspector = function.initialize(argumentInspectors);
isArgsSingleArray = HiveFunctionUtil.isSingleBoxedArray(argTypes);
conversions = new HiveObjectConversion[argumentInspectors.length];
for (int i = 0; i < argumentInspectors.length; i++) {
conversions[i] = HiveInspectors.getConversion(argumentInspectors[i], argTypes[i].getLogicalType(), hiveShim);
}
allIdentityConverter = Arrays.stream(conversions).allMatch(conv -> conv instanceof IdentityConversion);
}
Aggregations