1 |
|
2 |
|
3 | var skale = require('skale-engine');
|
4 | var sc = skale.context();
|
5 |
|
6 | var data = [['hello', 1], ['world', 1], ['hello', 2], ['world', 2], ['cedric', 3]];
|
7 |
|
8 | sc.parallelize(data)
|
9 | .partitionBy(new skale.HashPartitioner(3))
|
10 | .collect(function(err, res) {
|
11 | console.log(res);
|
12 | console.assert(JSON.stringify(res) === JSON.stringify([['world', 1], ['world', 2],['hello', 1],['hello', 2],['cedric', 3]]));
|
13 | sc.end();
|
14 | });
|