JingGe commented on a change in pull request #18397:
URL: https://github.com/apache/flink/pull/18397#discussion_r790964213
##########
File path:
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/KafkaRecordSerializationSchemaBuilderTest.java
##########
@@ -160,6 +165,37 @@ public void testSerializeRecordWithKey() {
assertArrayEquals(record.value(), serializationSchema.serialize("a"));
}
+ @Test
+ public void testNoConfigurableKafkaKeySerializer() throws Exception {
+ final Map<String, String> config = ImmutableMap.of("simpleKey",
"simpleValue");
+ final KafkaRecordSerializationSchema<String> schema =
+ KafkaRecordSerializationSchema.builder()
+ .setTopic(DEFAULT_TOPIC)
+ // use StringSerializer as dummy Serializer, since
ValueSerializer is
Review comment:
I'll change it. Just out of curiosity, I didn't find the consistency
rule of single line comment with the first letter being capital. There are also
many opposite examples in the codebase, e.g.
https://github.com/JingGe/flink/blob/master/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/StreamFormatAdapter.java
https://github.com/JingGe/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
##########
File path:
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/KafkaRecordSerializationSchemaBuilderTest.java
##########
@@ -160,6 +165,37 @@ public void testSerializeRecordWithKey() {
assertArrayEquals(record.value(), serializationSchema.serialize("a"));
}
+ @Test
+ public void testNoConfigurableKafkaKeySerializer() throws Exception {
+ final Map<String, String> config = ImmutableMap.of("simpleKey",
"simpleValue");
+ final KafkaRecordSerializationSchema<String> schema =
+ KafkaRecordSerializationSchema.builder()
+ .setTopic(DEFAULT_TOPIC)
+ // use StringSerializer as dummy Serializer, since
ValueSerializer is
Review comment:
I'll change it. Just out of curiosity, I didn't find the consistency
rule of single line comment with the first letter being capital. There are also
many opposite examples using lowercase in the codebase, e.g.
https://github.com/JingGe/flink/blob/master/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/StreamFormatAdapter.java
https://github.com/JingGe/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
##########
File path:
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/KafkaRecordSerializationSchemaBuilderTest.java
##########
@@ -160,6 +165,37 @@ public void testSerializeRecordWithKey() {
assertArrayEquals(record.value(), serializationSchema.serialize("a"));
}
+ @Test
+ public void testNoConfigurableKafkaKeySerializer() throws Exception {
+ final Map<String, String> config = ImmutableMap.of("simpleKey",
"simpleValue");
+ final KafkaRecordSerializationSchema<String> schema =
+ KafkaRecordSerializationSchema.builder()
+ .setTopic(DEFAULT_TOPIC)
+ // use StringSerializer as dummy Serializer, since
ValueSerializer is
Review comment:
I'll change it. Just out of curiosity, I didn't find the consistency
rule of single line comment with the first letter being capital. There are also
many opposite examples using lowercase in the codebase, e.g.
https://github.com/apache/flink/blob/master/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/src/impl/StreamFormatAdapter.java
https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
##########
File path:
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/reader/deserializer/KafkaValueOnlyDeserializerWrapper.java
##########
@@ -36,10 +36,15 @@
/** A package private class to wrap {@link Deserializer}. */
class KafkaValueOnlyDeserializerWrapper<T> implements
KafkaRecordDeserializationSchema<T> {
+
private static final long serialVersionUID = 5409547407386004054L;
+
private static final Logger LOG =
LoggerFactory.getLogger(KafkaValueOnlyDeserializerWrapper.class);
+
private final Class<? extends Deserializer<T>> deserializerClass;
+ // always be false since this Deserializer is only used for value.
Review comment:
Code style consistency means in this case that developers, when they
come from `KafkaSerializerWrapper` will check the `isKey` at first to see if
`deserializer.configure(...)` has been used in
`KafkaValueOnlyDeserializerWrapper`. It is much easier to check it via instance
variable than digging into the code. If you would try to read both classes back
and forth, you would get the feeling.
It is not a big deal. I will change it back.
--
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]