Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-7358

Developing "GroupByMultiKey"

Details

    • New Feature
    • Status: Open
    • P3
    • Resolution: Unresolved
    • None
    • None
    • beam-model, sdk-ideas
    • None

    Description

      GroupByKey is useful, but it is difficult to express complex grouping conditions.

      I propose the development of the function to group if there is a common term in even one of multiple keys.

      Like this....

       

      usage

       

      List io = Arrays.asList(
      KV.of(new MultiKey("A","C", "E"),"0"),
       KV.of(new MultiKey("A","D", "F"),"1"),
       KV.of(new MultiKey("B","D", "G"),"2"),
       KV.of(new MultiKey("H","J", "L"),"3"),
       KV.of(new MultiKey("I","K", "L"),"4"),
       KV.of(new MultiKey("M","C", "O"),"5"),
       KV.of(new MultiKey(null,null, "O"),"6"),
       KV.of(new MultiKey(null,null, null),"7")
      );
      p.apply(Create.of(io))
      .apply(GroupByMultiKey.create(3))
      .apply(new DebugPrintln());
      

       

       out put this

       

      [KV{["A","C","E"],"0"},KV{["A","D","F"],"1"},KV{["B","D","G"],"2"},KV{["M","C","O"],"5"},KV{[null,null,"O"],"6"}]

      [KV{["H","J","L"],"3"},KV{["I","K","L"],"4"}]

      [KV{[null,null,null],"7"}]

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            naoki Hyu Naoki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: