imaffe commented on a change in pull request #18406:
URL: https://github.com/apache/flink/pull/18406#discussion_r809700230
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarPartitionSplitReaderBase.java
##########
@@ -192,28 +199,37 @@ public void close() {
}
@Nullable
- protected abstract Message<byte[]> pollMessage(Duration timeout)
+ protected abstract Message<?> pollMessage(Duration timeout)
throws ExecutionException, InterruptedException,
PulsarClientException;
- protected abstract void finishedPollMessage(Message<byte[]> message);
+ protected abstract void finishedPollMessage(Message<?> message);
- protected abstract void startConsumer(PulsarPartitionSplit split,
Consumer<byte[]> consumer);
+ protected abstract void startConsumer(PulsarPartitionSplit split,
Consumer<?> consumer);
// --------------------------- Helper Methods -----------------------------
protected boolean isNotWakeup() {
return !wakeup.get();
}
- /** Create a specified {@link Consumer} by the given split information. */
- protected Consumer<byte[]> createPulsarConsumer(PulsarPartitionSplit
split) {
+ /**
+ * Create a specified {@link Consumer} by the given split information. If
using pulsar schema,
+ * then use the pulsar schema, if using flink schema, then use a
Schema.BYTES
+ */
+ protected Consumer<?> createPulsarConsumer(PulsarPartitionSplit split) {
return createPulsarConsumer(split.getPartition());
}
- /** Create a specified {@link Consumer} by the given topic partition. */
- protected Consumer<byte[]> createPulsarConsumer(TopicPartition partition) {
- ConsumerBuilder<byte[]> consumerBuilder =
- createConsumerBuilder(pulsarClient, Schema.BYTES,
sourceConfiguration);
+ protected Consumer<?> createPulsarConsumer(TopicPartition partition) {
+ Schema<?> schema;
+ if (sourceConfiguration.isEnableSchemaEvolution()) {
+ schema = deserializationSchema.schema();
Review comment:
And here flinkSchema can implement the schema() method as well. So we
don't need to check isEnableSchemaEvolution
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]