TheNeuralBit commented on a change in pull request #12520:
URL: https://github.com/apache/beam/pull/12520#discussion_r468225048



##########
File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AutoValueUtils.java
##########
@@ -139,11 +139,15 @@ private static boolean matchConstructor(
                 Collectors.toMap(
                     f -> 
ReflectUtils.stripGetterPrefix(f.getMethod().getName()),
                     Function.identity()));
-    for (FieldValueTypeInformation type : getterTypes) {
-      if (typeMap.get(type.getName()) == null) {
+
+    // Verify that constructor parameters match (name and type) the inferred 
schema.
+    for (Parameter parameter : constructor.getParameters()) {
+      FieldValueTypeInformation type = 
typeMap.getOrDefault(parameter.getName(), null);
+      if (type == null || type.getRawType() != parameter.getType()) {

Review comment:
       I'm not quite sure what the old logic was trying to verify. Now this 
verifies that every constructor parameter corresponds to a schema field.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to