zhangjun0x01 commented on code in PR #584: URL: https://github.com/apache/incubator-paimon/pull/584#discussion_r1145071909
########## paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/DataTableSource.java: ########## @@ -163,15 +167,44 @@ public ScanRuntimeProvider getScanRuntimeProvider(ScanContext scanContext) { .withProjection(projectFields) .withPredicate(predicate) .withLimit(limit) - .withParallelism( - Options.fromMap(table.schema().options()) - .get(FlinkConnectorOptions.SCAN_PARALLELISM)) + .withParallelism(inferParallelism()) .withWatermarkStrategy(watermarkStrategy); return new PaimonDataStreamScanProvider( !streaming, env -> sourceBuilder.withEnv(env).build()); } + private Integer inferParallelism() { + Options options = Options.fromMap(this.table.schema().options()); + Integer parallelism = options.get(FlinkConnectorOptions.SCAN_PARALLELISM); + + if (options.get(FlinkConnectorOptions.INFER_SCAN_PARALLELISM)) { + // for streaming mode, set the default parallelism to the bucket number. + if (streaming) { + parallelism = options.get(CoreOptions.BUCKET); + } else { + int splitSize = 1; Review Comment: for empty ,the split will be empty, my initial idea was init the `splitSize ` to 1 to guarantee inferred parallelism should be at least 1 -- 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: issues-unsubscr...@paimon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org