JingsongLi commented on code in PR #2306:
URL: https://github.com/apache/incubator-paimon/pull/2306#discussion_r1390775446
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/StaticFileStoreSplitEnumerator.java:
##########
@@ -65,59 +49,10 @@ public StaticFileStoreSplitEnumerator(
@Nullable Snapshot snapshot,
SplitAssigner splitAssigner,
@Nullable DynamicPartitionFilteringInfo
dynamicPartitionFilteringInfo) {
- this.context = context;
- this.snapshot = snapshot;
- this.splitAssigner = splitAssigner;
+ super(context, snapshot, splitAssigner);
this.dynamicPartitionFilteringInfo = dynamicPartitionFilteringInfo;
}
- @Override
- public void start() {
- // no resources to start
- }
-
- @Override
- public void handleSplitRequest(int subtask, @Nullable String hostname) {
- if (!context.registeredReaders().containsKey(subtask)) {
- // reader failed between sending the request and now. skip this
request.
- return;
- }
-
- List<FileStoreSourceSplit> assignment = splitAssigner.getNext(subtask,
hostname);
- if (assignment.size() > 0) {
- context.assignSplits(
- new SplitsAssignment<>(Collections.singletonMap(subtask,
assignment)));
- } else {
- context.signalNoMoreSplits(subtask);
- }
- }
-
- @Override
- public void addSplitsBack(List<FileStoreSourceSplit> backSplits, int
subtaskId) {
- splitAssigner.addSplitsBack(subtaskId, backSplits);
- }
-
- @Override
- public void addReader(int subtaskId) {
- // this source is purely lazy-pull-based, nothing to do upon
registration
- }
-
- @Override
- public PendingSplitsCheckpoint snapshotState(long checkpointId) {
- return new PendingSplitsCheckpoint(
- splitAssigner.remainingSplits(), snapshot == null ? null :
snapshot.id());
- }
-
- @Override
- public void close() {
- // no resources to close
- }
-
- @Nullable
- public Snapshot snapshot() {
- return snapshot;
- }
-
@Override
public void handleSourceEvent(int subtaskId, SourceEvent sourceEvent) {
if (sourceEvent instanceof DynamicFilteringEvent) {
Review Comment:
Can we modify this to `if (sourceEvent != null &&
sourceEvent.getClass().getName().endsWith("DynamicFilteringEvent"))`?
And extract DynamicFiltering logical from here to a separate class?
In this way, we can avoid to introduce class to 1.14 and 1.15. (Small
reflection is better than multiple copies)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]