dailai commented on code in PR #6766:
URL: https://github.com/apache/seatunnel/pull/6766#discussion_r1582608793
##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/PaimonSourceSplitEnumerator.java:
##########
@@ -39,36 +44,51 @@ public class PaimonSourceSplitEnumerator
/** Source split enumerator context */
private final Context<PaimonSourceSplit> context;
- /** The splits that has assigned */
- private final Set<PaimonSourceSplit> assignedSplit;
+ private Map<Integer, List<PaimonSourceSplit>> pendingSplit;
- /** The splits that have not assigned */
- private Set<PaimonSourceSplit> pendingSplit;
+ private volatile boolean shouldEnumerate;
+
+ private final Object stateLock = new Object();
/** The table that wants to read */
private final Table table;
public PaimonSourceSplitEnumerator(Context<PaimonSourceSplit> context,
Table table) {
- this.context = context;
- this.table = table;
- this.assignedSplit = new HashSet<>();
+ this(context, table, null);
}
public PaimonSourceSplitEnumerator(
Context<PaimonSourceSplit> context, Table table, PaimonSourceState
sourceState) {
this.context = context;
this.table = table;
- this.assignedSplit = sourceState.getAssignedSplits();
+ this.pendingSplit = new HashMap<>();
+ this.shouldEnumerate = sourceState == null;
+ if (sourceState != null) {
+ this.shouldEnumerate = sourceState.isShouldEnumerate();
+ this.pendingSplit.putAll(sourceState.getPendingSplits());
+ }
}
@Override
public void open() {
- this.pendingSplit = new HashSet<>();
+ this.pendingSplit = new HashedMap();
Review Comment:
This will overwrite the init in the construct method.
--
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]