[
https://issues.apache.org/jira/browse/BEAM-7358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hyu Naoki updated BEAM-7358:
----------------------------
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
{code:java}
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());
{code}
out put this
{noformat}
[
[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"}]
]
{noformat}
was:
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
{code:java}
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());
{code}
output this
{quote}[
[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"}]
]
{quote}
> Developing "GroupByMultiKey"
> -----------------------------
>
> Key: BEAM-7358
> URL: https://issues.apache.org/jira/browse/BEAM-7358
> Project: Beam
> Issue Type: New Feature
> Components: beam-model
> Reporter: Hyu Naoki
> Priority: Major
>
> 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
>
> {code:java}
> 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());
> {code}
>
> out put this
>
> {noformat}
> [
> [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"}]
> ]
>
> {noformat}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)