Below example to explain different between sort and sortByKey.
Source and target message type:
Source data isĀ unsorted col1 and sorted col2. Both col1 and col2 is a pair of values.
Target data should be sorted col1, and the col2 is sorted according to col1, since both col1 and col2 is a pair.
row field use one-to-one mapping.
col1 use ‘sort’ to sort ascending from C,B,D,A to A,B,C,D.
Before sort need to use ‘removeContext’, because’ sort’ expect list of values under single context.
After sort need to use SplitByValue [Each value], to restore back context change for each values.
col2 use ‘sortByKey’ to sort based on col1 order from1,2,3,4 to 4,2,1,3.
Keep on learning!

Different between Sort and SortByKey
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *