You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/09/01 09:20:46 UTC
[GitHub] [flink] twalthr commented on a change in pull request #17060: [FLINK-23895][table] Upsert materializer is not inserted for all sink providers
twalthr commented on a change in pull request #17060:
URL: https://github.com/apache/flink/pull/17060#discussion_r699129141
##########
File path: flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecSink.java
##########
@@ -260,76 +191,135 @@ public DynamicTableSinkSpec getTableSinkSpec() {
* the parallelism is provided, otherwise it uses parallelism of input transformation.
*/
private int deriveSinkParallelism(
- ParallelismProvider parallelismProvider, int inputParallelism) {
- final Optional<Integer> parallelismOptional = parallelismProvider.getParallelism();
- if (parallelismOptional.isPresent()) {
- int sinkParallelism = parallelismOptional.get();
- if (sinkParallelism <= 0) {
- throw new TableException(
- String.format(
- "Table: %s configured sink parallelism: "
- + "%s should not be less than zero or equal to zero",
- tableSinkSpec.getObjectIdentifier().asSummaryString(),
- sinkParallelism));
- }
- return sinkParallelism;
- } else {
- // use input parallelism if not specified
+ Transformation<RowData> inputTransform, SinkRuntimeProvider runtimeProvider) {
+ final int inputParallelism = inputTransform.getParallelism();
+ if (!(runtimeProvider instanceof ParallelismProvider)) {
return inputParallelism;
}
+ final ParallelismProvider parallelismProvider = (ParallelismProvider) runtimeProvider;
+ return parallelismProvider
+ .getParallelism()
+ .map(
+ sinkParallelism -> {
+ if (sinkParallelism <= 0) {
+ throw new TableException(
+ String.format(
+ "Invalid configured parallelism %s for table '%s'.",
+ sinkParallelism,
+ tableSinkSpec
+ .getObjectIdentifier()
+ .asSummaryString()));
Review comment:
Let's not start this discussion now. It seems the backticks are hard to read in strings. We could have used `asSummaryString` in `toString` but now it is kind of too late I guess.
--
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org