[ 
https://issues.apache.org/jira/browse/BEAM-4076?focusedWorklogId=116285&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-116285
 ]

ASF GitHub Bot logged work on BEAM-4076:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Jun/18 03:31
            Start Date: 27/Jun/18 03:31
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on a change in pull request 
#5545: [BEAM-4076] Import Schema branch into master
URL: https://github.com/apache/beam/pull/5545#discussion_r198357030
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/ParDo.java
 ##########
 @@ -479,6 +483,43 @@ private static void validateStateApplicableForInput(
     }
   }
 
+  private static void validateRowParameter(
+      RowParameter rowParameter,
+      Coder<?> inputCoder,
+      Map<String, FieldAccessDeclaration> fieldAccessDeclarations,
+      DoFn<?, ?> fn) {
+    checkArgument(inputCoder instanceof SchemaCoder,
+        "Cannot access object as a row if the input PCollection does not have 
a schema ."
+            + " Coder " + inputCoder.getClass().getSimpleName());
+
+    // Resolve the FieldAccessDescriptor against the Schema.
+    // This will be resolved anyway by the runner, however we want any 
resolution errors
+    // (i.e. caused by a FieldAccessDescriptor that references fields not in 
the schema) to
+    // be caught and presented to the user at graph-construction time. 
Therefore we resolve
+    // here as well to catch these errors.
+    FieldAccessDescriptor fieldAccessDescriptor = null;
+    String id = rowParameter.fieldAccessId();
+    if (id == null) {
+      // This is the case where no FieldId is defined, just an @Element Row 
row. Default to all
+      // fields accessed.
+      fieldAccessDescriptor = FieldAccessDescriptor.withAllFields();
+    } else {
+      // In this case, we expect to have a FieldAccessDescriptor defined in 
the class.
+      FieldAccessDeclaration fieldAccessDeclaration = 
fieldAccessDeclarations.get(id);
+      checkArgument(fieldAccessDeclaration != null,
+          "No FieldAccessDescriptor defined with id", id);
 
 Review comment:
        
   FieldAccessDeclaration ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 116285)
    Time Spent: 2h 10m  (was: 2h)

> Schema followups
> ----------------
>
>                 Key: BEAM-4076
>                 URL: https://issues.apache.org/jira/browse/BEAM-4076
>             Project: Beam
>          Issue Type: Improvement
>          Components: beam-model, dsl-sql, sdk-java-core
>            Reporter: Kenneth Knowles
>            Priority: Major
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> This umbrella bug contains subtasks with followups for Beam schemas, which 
> were moved from SQL to the core Java SDK and made to be type-name-based 
> rather than coder based.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to