[
https://issues.apache.org/jira/browse/FLINK-10235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691356#comment-16691356
]
ASF GitHub Bot commented on FLINK-10235:
----------------------------------------
zentol closed pull request #6653: [FLINK-10235][kafka] Explicitly cast custom
partitioner classes
URL: https://github.com/apache/flink/pull/6653
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceSinkFactoryBase.java
b/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceSinkFactoryBase.java
index 5634331adbb..09567ff7a3c 100644
---
a/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceSinkFactoryBase.java
+++
b/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceSinkFactoryBase.java
@@ -335,7 +335,7 @@ private StartupOptions getStartupOptions(
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));
+ return
Optional.of((FlinkKafkaPartitioner<Row>)
InstantiationUtil.instantiate(partitionerClass));
default:
throw new
TableException("Unsupported sink partitioner. Validator should have checked
that.");
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> KafkaTableSourceSinkFactoryBase#getFlinkKafkaPartitioner does not compile
> with Java 9
> -------------------------------------------------------------------------------------
>
> Key: FLINK-10235
> URL: https://issues.apache.org/jira/browse/FLINK-10235
> Project: Flink
> Issue Type: Sub-task
> Components: Table API & SQL
> Affects Versions: 1.7.0
> Reporter: Chesnay Schepler
> Assignee: Chesnay Schepler
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.8.0
>
>
> 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>>}}.
> {code}
> 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.");
> }
> });
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)