Search in sources :

Example 1 with StreamRecordRowDataWrappingCollector

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;
}
Also used : StreamRecordRowDataWrappingCollector(org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) RowDataSerializer(org.apache.flink.table.runtime.typeutils.RowDataSerializer)

Example 2 with StreamRecordRowDataWrappingCollector

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());
    }
}
Also used : StreamRecordRowDataWrappingCollector(org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector) GenericRowData(org.apache.flink.table.data.GenericRowData) RowType(org.apache.flink.table.types.logical.RowType) PythonTypeUtils(org.apache.flink.table.runtime.typeutils.PythonTypeUtils)

Example 3 with StreamRecordRowDataWrappingCollector

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;
}
Also used : StreamRecordRowDataWrappingCollector(org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) ArrowSerializer(org.apache.flink.table.runtime.arrow.serializers.ArrowSerializer)

Example 4 with StreamRecordRowDataWrappingCollector

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();
}
Also used : StreamRecordRowDataWrappingCollector(org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector) DataOutputViewStreamWrapper(org.apache.flink.core.memory.DataOutputViewStreamWrapper) ByteArrayInputStreamWithPos(org.apache.flink.core.memory.ByteArrayInputStreamWithPos) DataInputViewStreamWrapper(org.apache.flink.core.memory.DataInputViewStreamWrapper) ByteArrayOutputStreamWithPos(org.apache.flink.core.memory.ByteArrayOutputStreamWithPos)

Example 5 with StreamRecordRowDataWrappingCollector

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());
}
Also used : StreamRecordRowDataWrappingCollector(org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData)

Aggregations

StreamRecordRowDataWrappingCollector (org.apache.flink.table.runtime.operators.python.utils.StreamRecordRowDataWrappingCollector)5 JoinedRowData (org.apache.flink.table.data.utils.JoinedRowData)3 ByteArrayInputStreamWithPos (org.apache.flink.core.memory.ByteArrayInputStreamWithPos)1 ByteArrayOutputStreamWithPos (org.apache.flink.core.memory.ByteArrayOutputStreamWithPos)1 DataInputViewStreamWrapper (org.apache.flink.core.memory.DataInputViewStreamWrapper)1 DataOutputViewStreamWrapper (org.apache.flink.core.memory.DataOutputViewStreamWrapper)1 GenericRowData (org.apache.flink.table.data.GenericRowData)1 ArrowSerializer (org.apache.flink.table.runtime.arrow.serializers.ArrowSerializer)1 PythonTypeUtils (org.apache.flink.table.runtime.typeutils.PythonTypeUtils)1 RowDataSerializer (org.apache.flink.table.runtime.typeutils.RowDataSerializer)1 RowType (org.apache.flink.table.types.logical.RowType)1