forked from hpcc-systems/HPCC-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hpcc-systems#2780 from jakesmith/rollupthor-2390
gh-2390 rollup matching transform result, not left Reviewed-By: Gavin Halliday <[email protected]> Reviewed-By: Richard Chapman <[email protected]>
- Loading branch information
Showing
3 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import std.system.thorlib; | ||
|
||
d := dataset([{1},{1},{2},{3},{4},{8},{9}], { unsigned r; }); | ||
|
||
d t(d L, d r) := transform | ||
SELF.r := IF (L.r=3,SKIP,L.r + 1); | ||
SELF.r := IF (L.r=3,SKIP,L.r + 1); | ||
END; | ||
|
||
rollup(d, t(LEFT, RIGHT), LEFT.r = RIGHT.r); | ||
rollup(d, t(LEFT, RIGHT), LEFT.r = RIGHT.r, LOCAL); | ||
rollup(d, t(LEFT, RIGHT), LEFT.r >= RIGHT.r-1, LOCAL); | ||
|
||
// spread across nodes and perform global rollup to string | ||
distd := DISTRIBUTE(d, r / (thorlib.nodes()+1)); | ||
p := PROJECT(distd, TRANSFORM({ d, string res:=''; }, SELF := LEFT)); | ||
p t2(p l, p r) := transform | ||
SELF.res := IF(L.res='',(string)l.r+(string)r.r,(string)l.res + (string)r.r); | ||
SELF.r := IF(R.r=4, SKIP, L.r); | ||
SELF := l; | ||
END; | ||
rollup(p, true, t2(LEFT, RIGHT)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters