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

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

                Author: ASF GitHub Bot
            Created on: 19/Feb/20 09:07
            Start Date: 19/Feb/20 09:07
    Worklog Time Spent: 10m 
      Work Description: alexvanboxel commented on pull request #10883: 
[BEAM-9331] Add better Row builders
URL: https://github.com/apache/beam/pull/10883#discussion_r381147867
 
 

 ##########
 File path: sdks/java/core/src/main/java/org/apache/beam/sdk/values/Row.java
 ##########
 @@ -599,272 +709,555 @@ public Builder addArray(Object... values) {
       return this;
     }
 
-    // Values are attached. No verification is done, and no conversions are 
done. LogicalType
-    // values must be specified as the base type.
+    // Values are attached. No verification is done, and no conversions are 
done. LogicalType values
+    // must be specified
+    // as the base type. This method should be used with great care, as no 
validation is done. If
+    // incorrect values are
+    // passed in, it could result in strange errors later in the pipeline. 
This method is largely
+    // used internal
+    // to Beam.
+    @Internal
     public Builder attachValues(List<Object> values) {
 
 Review comment:
   Maybe this is an opportunity to change the attachValues. No values should be 
set before or after the attach. I see 2 options to improve this:
   - In the attach first see if values are already set. Let the attachValues 
return the new Row directly. This is maybe a bit strange as it violates a 
builder pattern.
   - Have 4 build in builders. The starting one (that includes an` 
attachValues`, `add` and `withFieldValue`), all of them return a specific 
builder: the new `ModifyingBuilder` and a new `AddValuesBuilder` that only has 
the add methods and an `AttachBuilder` that only has build. This also 
eliminates some elaborate if/then/else's in the builder().
 
----------------------------------------------------------------
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


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

    Worklog Id:     (was: 389356)
    Time Spent: 1h  (was: 50m)

> The Row object needs better builders
> ------------------------------------
>
>                 Key: BEAM-9331
>                 URL: https://issues.apache.org/jira/browse/BEAM-9331
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Reuven Lax
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Users should be able to build a Row object by specifying field names. Desired 
> syntax:
>  
> Row.withSchema(schema)
>    .withFieldName("field1", "value)
>   .withFieldName("field2.field3", value)
>   .build()
>  
> Users should also have a builder that allows taking an existing row and 
> changing specific fields.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to