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/11 01:09:17 UTC

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

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



##########
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 believe the getterTypes is the list of schema name, where typeMap is the attribute name from AutoValue class. It's trying to verify whether the schema matches the AutoValue class since it wants to get a constructor. 




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