Search in sources :

Example 1 with ProviderContext

use of org.apache.flink.table.connector.ProviderContext in project flink by apache.

the class ExternalDynamicSource method getScanRuntimeProvider.

@Override
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) {
    final DataStructureConverter physicalConverter = runtimeProviderContext.createDataStructureConverter(physicalDataType);
    final Transformation<E> externalTransformation = dataStream.getTransformation();
    final boolean isBounded = !isUnboundedSource(externalTransformation) && externalTransformation.getTransitivePredecessors().stream().noneMatch(this::isUnboundedSource);
    return new TransformationScanProvider() {

        @Override
        public Transformation<RowData> createTransformation(ProviderContext providerContext) {
            return ExecNodeUtil.createOneInputTransformation(externalTransformation, providerContext.generateUid(EXTERNAL_DATASTREAM_TRANSFORMATION).map(uid -> new TransformationMetadata(uid, generateOperatorName(), generateOperatorDesc())).orElseGet(() -> new TransformationMetadata(generateOperatorName(), generateOperatorDesc())), new InputConversionOperator<>(physicalConverter, !isTopLevelRecord, produceRowtimeMetadata, propagateWatermark, changelogMode.containsOnly(RowKind.INSERT)), // will be filled by the framework
            null, externalTransformation.getParallelism());
        }

        @Override
        public boolean isBounded() {
            return isBounded;
        }
    };
}
Also used : RowData(org.apache.flink.table.data.RowData) TransformationMetadata(org.apache.flink.table.planner.plan.nodes.exec.utils.TransformationMetadata) ProviderContext(org.apache.flink.table.connector.ProviderContext)

Aggregations

ProviderContext (org.apache.flink.table.connector.ProviderContext)1 RowData (org.apache.flink.table.data.RowData)1 TransformationMetadata (org.apache.flink.table.planner.plan.nodes.exec.utils.TransformationMetadata)1