Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-8033 JDK 9 support
  3. FLINK-10235

KafkaTableSourceSinkFactoryBase#getFlinkKafkaPartitioner does not compile with Java 9

    XMLWordPrintableJSON

    Details

      Description

      The method compilation fails on java 9. The problem is that the CONNECTOR_SINK_PARTITIONER_VALUE_CUSTOM branch returns an Optional<Class<? extends FlinkKafkaPartitioner>>, but the method requires a Optional<FlinkKafkaPartitioner<Row>>.

      private Optional<FlinkKafkaPartitioner<Row>> getFlinkKafkaPartitioner(DescriptorProperties descriptorProperties) {
      	return descriptorProperties
      		.getOptionalString(CONNECTOR_SINK_PARTITIONER)
      		.flatMap((String partitionerString) -> {
      			switch (partitionerString) {
      				case CONNECTOR_SINK_PARTITIONER_VALUE_FIXED:
      					return Optional.of(new FlinkFixedPartitioner<>());
      				case CONNECTOR_SINK_PARTITIONER_VALUE_ROUND_ROBIN:
      					return Optional.empty();
      				case CONNECTOR_SINK_PARTITIONER_VALUE_CUSTOM:
      					final Class<? extends FlinkKafkaPartitioner> partitionerClass =
      						descriptorProperties.getClass(CONNECTOR_SINK_PARTITIONER_CLASS, FlinkKafkaPartitioner.class);
      					return Optional.of(InstantiationUtil.instantiate(partitionerClass));
      				default:
      					throw new TableException("Unsupported sink partitioner. Validator should have checked that.");
      			}
      		});
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chesnay Chesnay Schepler
                Reporter:
                chesnay Chesnay Schepler
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: