snuyanzin commented on code in PR #24035:
URL: https://github.com/apache/flink/pull/24035#discussion_r1499119629
##########
flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/ProtoToRowConverter.java:
##########
@@ -68,17 +68,14 @@ public ProtoToRowConverter(RowType rowType, PbFormatConfig
formatConfig)
true,
Thread.currentThread().getContextClassLoader());
String fullMessageClassName =
PbFormatUtils.getFullJavaName(descriptor);
+ boolean readDefaultValuesForPrimitiveTypes =
formatConfig.isReadDefaultValues();
if (descriptor.getFile().getSyntax() == Syntax.PROTO3) {
- // pb3 always read default values
- formatConfig =
- new PbFormatConfig(
- formatConfig.getMessageClassName(),
- formatConfig.isIgnoreParseErrors(),
- true,
- formatConfig.getWriteNullStringLiterals());
+ // pb3 always read default values for primitive types
+ readDefaultValuesForPrimitiveTypes = true;
}
PbCodegenAppender codegenAppender = new PbCodegenAppender();
- PbFormatContext pbFormatContext = new
PbFormatContext(formatConfig);
+ PbFormatContext pbFormatContext =
+ new PbFormatContext(formatConfig,
readDefaultValuesForPrimitiveTypes);
Review Comment:
since this class was touched: a nit comment
the line below
```java
String uuid = UUID.randomUUID().toString().replaceAll("\\-", "");
```
could be replaced with
```java
String uuid = UUID.randomUUID().toString().replace("-", "");
```
to avoid compilation of patterns
--
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]