zhangshenghang commented on code in PR #10102:
URL: https://github.com/apache/seatunnel/pull/10102#discussion_r2556343406
##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/PaimonSource.java:
##########
@@ -179,4 +182,31 @@ public SourceSplitEnumerator<PaimonSourceSplit,
PaimonSourceState> restoreEnumer
readBuilders,
1);
}
+
+ /** Infer parallelism based on Paimon data partition count. */
+ @Override
+ public int inferParallelism() {
+ try {
+ for (Map.Entry<String, ReadBuilder> entry :
readBuilders.entrySet()) {
+ String tableKey = entry.getKey();
+ ReadBuilder readBuilder = entry.getValue();
+ try {
+ List<PartitionEntry> partitionEntries =
+ readBuilder.newScan().listPartitionEntries();
+ return !partitionEntries.isEmpty() ?
partitionEntries.size() : 1;
+ } catch (Exception e) {
+ log.warn(
+ "Failed to get partition info for table {},
skipping parallelism inference",
+ tableKey,
+ e);
+ return -1;
+ }
+ }
+
+ } catch (Exception e) {
+ log.warn("Failed to infer parallelism for Paimon source", e);
+ return -1;
+ }
+ return 1;
+ }
Review Comment:
Only take the first table? Could you explain the design?
--
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]