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

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

                Author: ASF GitHub Bot
            Created on: 03/Mar/20 22:50
            Start Date: 03/Mar/20 22:50
    Worklog Time Spent: 10m 
      Work Description: KevinGG commented on pull request #11020: [BEAM-7926] 
Update Data Visualization
URL: https://github.com/apache/beam/pull/11020#discussion_r387276995
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/interactive/display/pcoll_visualization.py
 ##########
 @@ -215,20 +287,32 @@ def display_facets(self, updating_pv=None):
     # Ensures that dive, overview and table render the same data because the
     # materialized PCollection data might being updated continuously.
     data = self._to_dataframe()
+    # String-ify the dictionaries for display because elements of type dict
+    # cannot be ordered.
+    data = data.applymap(lambda x: str(x) if isinstance(x, dict) else x)
     if updating_pv:
-      self._display_dive(data, updating_pv._dive_display_id)
-      self._display_overview(data, updating_pv._overview_display_id)
-      self._display_dataframe(data, updating_pv._df_display_id)
+      # Only updates when data is not empty. Otherwise, consider it a bad
+      # iteration and noop since there is nothing to be updated.
+      if data.empty:
+        _LOGGER.debug('Skip a visualization update due to empty data.')
+      else:
+        self._display_dataframe(data.copy(deep=True), updating_pv)
+        if self._display_facets:
+          self._display_dive(data.copy(deep=True), updating_pv)
 
 Review comment:
   Because we make different changes (such as formatting and dropping some 
columns) to the dataframe before displaying it in these 3 widgets.
   For example, window info needs to be formatted for facets-dive and datatable 
while getting dropped in facets-overview.
   
   If they share the same instance, the 3 widgets will be altering the same 
dataframe object in arbitrary order, get arbitrary mixed output or run into all 
kinds of mapping errors.
   
 
----------------------------------------------------------------
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: 397101)
    Time Spent: 51h 40m  (was: 51.5h)

> Show PCollection with Interactive Beam in a data-centric user flow
> ------------------------------------------------------------------
>
>                 Key: BEAM-7926
>                 URL: https://issues.apache.org/jira/browse/BEAM-7926
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-py-interactive
>            Reporter: Ning Kang
>            Assignee: Ning Kang
>            Priority: Major
>          Time Spent: 51h 40m
>  Remaining Estimate: 0h
>
> Support auto plotting / charting of materialized data of a given PCollection 
> with Interactive Beam.
> Say an Interactive Beam pipeline defined as
>  
> {code:java}
> p = beam.Pipeline(InteractiveRunner())
> pcoll = p | 'Transform' >> transform()
> pcoll2 = ...
> pcoll3 = ...{code}
> The use can call a single function and get auto-magical charting of the data.
> e.g.,
> {code:java}
> show(pcoll, pcoll2)
> {code}
> Throughout the process, a pipeline fragment is built to include only 
> transforms necessary to produce the desired pcolls (pcoll and pcoll2) and 
> execute that fragment.
> This makes the Interactive Beam user flow data-centric.
>  
> Detailed 
> [design|https://docs.google.com/document/d/1DYWrT6GL_qDCXhRMoxpjinlVAfHeVilK5Mtf8gO6zxQ/edit#heading=h.v6k2o3roarzz].



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

Reply via email to