title: Apache beam multiple output for a single dictionary
body: <p>I have written this function to be able to create 5 dictionaries from a single one and to pass it into Mapin apache beam to produce another Pcollection.</p>
  <p>Input :
  col1,Col2, Col3, Market_0_30, DealerMake_0_30, Market_31_60, DealerMake_31_60, Market_61_90, DealerMake_61_90, Market_91_120, DealerMake_91_120, Market_121, DealerMake_121,</p>
  <p>Output:
  line 1:
  col1, col2, Col3, Market, DealerMake, Age: 0_30</p>
  <p>line 2:
  col1, col2, Col3, Market, DealerMake, Age: 31_60</p>
  <p>line 3:
  col1, col2, Col3, Market, DealerMake, Age: 31_60</p>
  <pre><code>        def _expand(element: Dict) -&gt; List:
          common_columns = {}
          for key in element.keys():
              if key not in markets and key not in dealermakers:
                  common_columns[key] = element[key]
  
          lines = {}
          for i, (market, dealermaker) in enumerate(zip(markets, dealermakers)):
              line = {}
              line = common_columns.copy()
              line[market] = element[market]
              line[dealermaker] = element[dealermaker]
          return lines
      output = sources_data[&quot;group_stocks_view&quot;] | &quot;EXPAND&quot; &gt;&gt; beam.Map(_expand) | &quot;PRINT&quot; &gt;&gt; beam.Map(print)
  </code></pre>
  <p>But I always get an empty Pcollection at the end.</p>
  <p>Any help please ?</p>
  <p>Regards,</p>