use of org.apache.flink.table.runtime.typeutils.PythonTypeUtils in project flink by apache.
the class EmbeddedPythonScalarFunctionOperator method open.
@SuppressWarnings("unchecked")
@Override
public void open() throws Exception {
isOneArg = udfInputOffsets.length == 1;
isOneFieldResult = udfOutputType.getFieldCount() == 1;
super.open();
rowDataWrapper = new StreamRecordRowDataWrappingCollector(output);
reuseResultRowData = new GenericRowData(udfOutputType.getFieldCount());
RowType userDefinedFunctionInputType = new RowType(Arrays.stream(udfInputOffsets).mapToObj(i -> inputType.getFields().get(i)).collect(Collectors.toList()));
userDefinedFunctionInputConverters = userDefinedFunctionInputType.getFields().stream().map(RowType.RowField::getType).map(PythonTypeUtils::toDataConverter).toArray(PythonTypeUtils.DataConverter[]::new);
userDefinedFunctionInputArgs = new Object[udfInputOffsets.length];
userDefinedFunctionOutputConverters = udfOutputType.getFields().stream().map(RowType.RowField::getType).map(PythonTypeUtils::toDataConverter).toArray(PythonTypeUtils.DataConverter[]::new);
if (forwardedFieldGeneratedProjection != null) {
forwardedFieldProjection = forwardedFieldGeneratedProjection.newInstance(Thread.currentThread().getContextClassLoader());
}
}
Aggregations