Allan 2012-08-07, 14:34
Hi to everybody!
I'm working on the implementation of rank operator, which successfully
passed all the e2e tests on a cluster.
Rank operator is composed by two physical operators: POCounter and PORank,
and it provides two functionalities:
1) First functionality is similar to ROW NUMBER like on SQL, which provides
a sequential number to each tuple.
This is implemented by two map-only works (one for each physical operator).
- POCounter adds to each tuple the task identifier (which is processing it)
and a local counter. Furthermore, POCounter register the total number of
processed tuples by each task, through the used of global counters.
After finished the POCounter, it is calculated the cumulative sum, which is
the summation of the total tuples processed by previous tasks, i.e. for
task0 cumulative sum is 0 (there is not tuples before), task1 cumulative
sum is the number of tuples processed by task0 (the only task before it is
task0), and so on.
- Finally, PORank reads the corresponding cumulative according to the task
id of each tuple and sums the local counter at the tuple.
An input example for the POCount could be:
result of POCounter, and input to the PORank:
and result after PORank processing:
2) Second functionality is RANK BY, which is based on set of ordered
And it requires another methodology:
First, the dataset is group by the desired columns. Then, this result is
sorted by the columns specified. And, at the end this result is processed
by POCounter and PORank.
As in the previous case, POCounter adds to each tuple the task identifier
and the local counter. But here, local counter is not sequentially
incremented. Instead, it is added the number of tuples in the bag (produced
within the previous "group by").
Another particular change is the fact of the global counter is also
incremented by the size of bags on each tuple.
Finally, PORank does the same as the previous implementation without
change. After that, the rank column is spread to each component on the bag
within a for each operator.
An input example for the POCounter (after sorting and grouping):
On this case, I would like to rank by the first column.
And after being processed by POCounter, and an input example for the PORank:
Then, the resulting after PORank:
Finally, the rank value is spread to each element at the bag through a for
each operator, resulting:
After testing some options, I got a way to illustrate the rank operator,
but I have some problems:
1.- I guess that due to the illustrator algorithm, resulting tuples after
POCounter produces numbers high counters values two or three times than
expected, for example:
2.- Until now, I get 1 tuple example after illustrate. How could I get at
least three or four tuples as result?
Thanks in advance for your replies,
Allan Avendaño S.
Rome - Italy
Gmail: [EMAIL PROTECTED]