mxm commented on code in PR #15494:
URL: https://github.com/apache/iceberg/pull/15494#discussion_r2872361907
##########
core/src/main/java/org/apache/iceberg/avro/BaseWriteBuilder.java:
##########
@@ -75,51 +75,73 @@ public ValueWriter<?> primitive(Schema primitive) {
LogicalType logicalType = primitive.getLogicalType();
if (logicalType != null) {
switch (logicalType.getName()) {
- case "date":
+ case "date" -> {
return ValueWriters.ints();
+ }
- case "time-micros":
+ case "time-micros" -> {
return ValueWriters.longs();
+ }
- case "timestamp-micros":
+ case "timestamp-micros" -> {
return ValueWriters.longs();
+ }
- case "timestamp-nanos":
+ case "timestamp-nanos" -> {
return ValueWriters.longs();
+ }
- case "decimal":
+ case "decimal" -> {
LogicalTypes.Decimal decimal = (LogicalTypes.Decimal) logicalType;
return ValueWriters.decimal(decimal.getPrecision(),
decimal.getScale());
+ }
- case "uuid":
+ case "uuid" -> {
return ValueWriters.uuids();
+ }
- default:
- throw new IllegalArgumentException("Unsupported logical type: " +
logicalType);
+ default -> throw new IllegalArgumentException("Unsupported logical
type: " + logicalType);
}
}
switch (primitive.getType()) {
- case NULL:
+ case NULL -> {
Review Comment:
I tried to get rid of curly brackets wherever possible. Here, we cannot
remove them because we have a `return` statement following. The implicit return
like in lambdas without curly brackets only works if we yield a value from the
switch statement.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]