All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.flink.lakesoul.source.LakeSoulSourceReader Maven / Gradle / Ivy

There is a newer version: 2.5.1-flink-1.17
Show newest version
// SPDX-FileCopyrightText: 2023 LakeSoul Contributors
//
// SPDX-License-Identifier: Apache-2.0

package org.apache.flink.lakesoul.source;

import org.apache.flink.api.connector.source.SourceReaderContext;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.connector.base.source.reader.RecordEmitter;
import org.apache.flink.connector.base.source.reader.SingleThreadMultiplexSourceReaderBase;
import org.apache.flink.connector.base.source.reader.splitreader.SplitReader;
import org.apache.flink.table.data.RowData;

import java.util.Map;
import java.util.function.Supplier;

public class LakeSoulSourceReader
        extends SingleThreadMultiplexSourceReaderBase<
        RowData, RowData, LakeSoulSplit, LakeSoulSplit> {

    public LakeSoulSourceReader(Supplier> splitReaderSupplier,
                                RecordEmitter recordEmitter,
                                Configuration config,
                                SourceReaderContext context) {
        super(splitReaderSupplier, recordEmitter, config, context);
    }

    @Override
    public void start(){
        if(getNumberOfCurrentlyAssignedSplits() == 0) {
            context.sendSplitRequest();
        }
    }

    @Override
    protected void onSplitFinished(Map finishedSplitIds) {
        context.sendSplitRequest();
    }

    @Override
    protected LakeSoulSplit initializedState(LakeSoulSplit split) {
        return split;
    }

    @Override
    protected LakeSoulSplit toSplitType(String splitId, LakeSoulSplit splitState) {

        return splitState;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy