chia7712 commented on code in PR #20614:
URL: https://github.com/apache/kafka/pull/20614#discussion_r2451762083
##########
clients/src/main/java/org/apache/kafka/common/protocol/types/Schema.java:
##########
@@ -173,6 +179,10 @@ public BoundField[] fields() {
return this.fields;
}
+ public boolean tolerateMissingFieldsWithDefaults() {
Review Comment:
this method is unused
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -342,9 +344,14 @@ private static boolean retainsBufferReference(Schema
schema) {
Schema.Visitor detector = new Schema.Visitor() {
@Override
public void visit(Type field) {
- if (field == BYTES || field == NULLABLE_BYTES || field ==
RECORDS ||
- field == COMPACT_BYTES || field == COMPACT_NULLABLE_BYTES)
+ // avoid BooleanExpressionComplexity checkstyle warning
Review Comment:
How about using a `Set` to keep track of those types
```java
private static final Set<FieldType> BUFFER_FIELD_TYPES = Set.of(
BYTES, NULLABLE_BYTES, COMPACT_BYTES, COMPACT_NULLABLE_BYTES,
RECORDS, NULLABLE_RECORDS, COMPACT_RECORDS, COMPACT_NULLABLE_RECORDS
);
if (BUFFER_FIELD_TYPES.contains(field)) {
hasBuffer.set(true);
}
```
##########
generator/src/main/java/org/apache/kafka/message/SchemaGenerator.java:
##########
@@ -107,15 +107,15 @@ void generateSchemas(String className, StructSpec struct,
for (FieldSpec field : struct.fields()) {
if (field.type().isStructArray()) {
FieldType.ArrayType arrayType = (FieldType.ArrayType)
field.type();
- generateSchemas(arrayType.elementType().toString(),
structRegistry.findStruct(field), versions);
+ generateSchemas(arrayType.elementType().toString(),
structRegistry.findStruct(field), versions, field.nullableVersions());
Review Comment:
Does this mean the array can accept a null element? If so, that seems odd,
since the protocol write does not check for null on each element in a `List`
--
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]