use of org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector in project flink by apache.
the class PythonTableFunctionOperator method open.
@Override
@SuppressWarnings("unchecked")
public void open() throws Exception {
super.open();
rowDataWrapper = new StreamRecordRowDataWrappingCollector(output);
reuseJoinedRow = new JoinedRowData();
udtfInputProjection = udtfInputGeneratedProjection.newInstance(Thread.currentThread().getContextClassLoader());
forwardedInputSerializer = new RowDataSerializer(inputType);
udtfInputTypeSerializer = PythonTypeUtils.toInternalSerializer(udfInputType);
udtfOutputTypeSerializer = PythonTypeUtils.toInternalSerializer(udfOutputType);
input = null;
hasJoined = false;
isFinishResult = true;
}
use of org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector 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());
}
}
use of org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector in project flink by apache.
the class AbstractArrowPythonAggregateFunctionOperator method open.
@SuppressWarnings("unchecked")
@Override
public void open() throws Exception {
super.open();
rowDataWrapper = new StreamRecordRowDataWrappingCollector(output);
reuseJoinedRow = new JoinedRowData();
udafInputProjection = udafInputGeneratedProjection.newInstance(Thread.currentThread().getContextClassLoader());
arrowSerializer = new ArrowSerializer(udfInputType, udfOutputType);
arrowSerializer.open(bais, baos);
currentBatchCount = 0;
}
use of org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector in project flink by apache.
the class AbstractPythonStreamAggregateOperator method open.
@Override
@SuppressWarnings("unchecked")
public void open() throws Exception {
bais = new ByteArrayInputStreamWithPos();
baisWrapper = new DataInputViewStreamWrapper(bais);
baos = new ByteArrayOutputStreamWithPos();
baosWrapper = new DataOutputViewStreamWrapper(baos);
userDefinedFunctionInputType = createUserDefinedFunctionInputType();
udfInputTypeSerializer = PythonTypeUtils.toInternalSerializer(userDefinedFunctionInputType);
userDefinedFunctionOutputType = createUserDefinedFunctionOutputType();
udfOutputTypeSerializer = PythonTypeUtils.toInternalSerializer(userDefinedFunctionOutputType);
rowDataWrapper = new StreamRecordRowDataWrappingCollector(output);
super.open();
configJobOptions();
}
use of org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector in project flink by apache.
the class AbstractPythonScalarFunctionOperator method open.
@SuppressWarnings("unchecked")
@Override
public void open() throws Exception {
super.open();
rowDataWrapper = new StreamRecordRowDataWrappingCollector(output);
reuseJoinedRow = new JoinedRowData();
udfInputProjection = udfInputGeneratedProjection.newInstance(Thread.currentThread().getContextClassLoader());
forwardedFieldProjection = forwardedFieldGeneratedProjection.newInstance(Thread.currentThread().getContextClassLoader());
}
Aggregations