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

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

                Author: ASF GitHub Bot
            Created on: 28/Sep/21 20:03
            Start Date: 28/Sep/21 20:03
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on a change in pull request #15564:
URL: https://github.com/apache/beam/pull/15564#discussion_r717112192



##########
File path: 
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/DisplayDataTranslation.java
##########
@@ -65,13 +64,22 @@
     return builder.build();
   }
 
-  private static ByteString translateStringUtf8(DisplayData.Item item) {
-    String value = String.valueOf(item.getValue() == null ? 
item.getShortValue() : item.getValue());
+  private static ByteString translate(DisplayData.Item item) {
     String label = item.getLabel() == null ? item.getKey() : item.getLabel();
-    return RunnerApi.LabelledPayload.newBuilder()
-        .setLabel(label)
-        .setStringValue(value)
-        .build()
-        .toByteString();
+    String namespace = item.getNamespace() == null ? "" : 
item.getNamespace().getName();
+    RunnerApi.LabelledPayload.Builder builder =
+        RunnerApi.LabelledPayload.newBuilder()
+            .setKey(item.getKey())
+            .setLabel(label)
+            .setNamespace(namespace);
+    Object valueObj = item.getValue() == null ? item.getShortValue() : 
item.getValue();
+    if (valueObj instanceof Boolean) {
+      builder.setBoolValue((Boolean) valueObj);
+    } else if (valueObj instanceof Number) {

Review comment:
       This might be lossy. Could you add an integer type as well? 

##########
File path: sdks/python/apache_beam/transforms/display.py
##########
@@ -149,13 +149,22 @@ def create_payload(dd):
       value = display_data_dict['value']
       if isinstance(value, str):
         return beam_runner_api_pb2.LabelledPayload(
-            label=label, string_value=value)
+            label=label,
+            string_value=value,
+            key=display_data_dict['key'],
+            namespace=display_data_dict.get('namespace', ''))
       elif isinstance(value, bool):
         return beam_runner_api_pb2.LabelledPayload(
-            label=label, bool_value=value)
+            label=label,
+            bool_value=value,
+            key=display_data_dict['key'],
+            namespace=display_data_dict.get('namespace', ''))
       elif isinstance(value, (int, float, complex)):

Review comment:
       Same.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 656599)
    Time Spent: 3h 50m  (was: 3h 40m)

> Populate display data in Beam protos.
> -------------------------------------
>
>                 Key: BEAM-11129
>                 URL: https://issues.apache.org/jira/browse/BEAM-11129
>             Project: Beam
>          Issue Type: Bug
>          Components: beam-model, sdk-java-core, sdk-py-core
>            Reporter: Robert Bradshaw
>            Assignee: Robert Bradshaw
>            Priority: P3
>              Labels: Clarified
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>




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

Reply via email to