Skip to content

Commit 68af363

Browse files
author
dapeng
committed
测试partition
1 parent 9995f58 commit 68af363

File tree

1 file changed

+2
-4
lines changed
  • kafka10/kafka10-sink/src/main/java/com/dtstack/flink/sql/sink/kafka

1 file changed

+2
-4
lines changed

kafka10/kafka10-sink/src/main/java/com/dtstack/flink/sql/sink/kafka/KafkaSink.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ public class KafkaSink implements RetractStreamTableSink<Row>, IStreamSinkGener<
6666
/** The schema of the table. */
6767
private TableSchema schema;
6868

69-
/** Partitioner to select Kafka partition for each item. */
70-
protected Optional<FlinkKafkaPartitioner<Row>> partitioner;
7169
private String[] partitionKeys;
7270

7371
@Override
@@ -82,7 +80,6 @@ public KafkaSink genStreamSink(TargetTableInfo targetTableInfo) {
8280
properties.setProperty(key, kafka10SinkTableInfo.getKafkaParam(key));
8381
}
8482

85-
this.partitioner = Optional.of(new CustomerFlinkPartition<>());
8683
this.partitionKeys = getPartitionKeys(kafka10SinkTableInfo);
8784
this.fieldNames = kafka10SinkTableInfo.getFields();
8885
TypeInformation[] types = new TypeInformation[kafka10SinkTableInfo.getFields().length];
@@ -102,7 +99,8 @@ public KafkaSink genStreamSink(TargetTableInfo targetTableInfo) {
10299
if (parallelism != null) {
103100
this.parallelism = parallelism;
104101
}
105-
this.kafkaProducer010 = (FlinkKafkaProducer010<Row>) new KafkaProducer010Factory().createKafkaProducer(kafka10SinkTableInfo, getOutputType().getTypeAt(1), properties, partitioner, partitionKeys);
102+
this.kafkaProducer010 = (FlinkKafkaProducer010<Row>) new KafkaProducer010Factory().createKafkaProducer(kafka10SinkTableInfo, getOutputType().getTypeAt(1), properties,
103+
Optional.of(new CustomerFlinkPartition<>()), partitionKeys);
106104
return this;
107105
}
108106

0 commit comments

Comments
 (0)