You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/08/10 22:40:44 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #12520: [BEAM-10633] Fix @SchemaFieldName in AutoValueSchema

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:
users@infra.apache.org