Sort¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
Any input is ignored. | None |
||
Output ➡️ |
Output is the sorted sequence. | [Any] |
||
From |
No | The name of the sequence variable to edit in place. | none |
Var([Any]) |
Join |
No | Other columns to join sort/filter using the input (they must be of the same length). | none |
None Var([Any]) [Var([Any])] |
Desc |
No | If sorting should be in descending order, defaults ascending. | false |
Bool |
Key |
No | The shards to use to transform the collection's items before they are compared. Can be None. | none |
Shard [Shard] None |
Sorts the elements of a sequence. Can also move around the elements of a joined sequence in alignment with the sorted sequence.
Details¶
This shard can also take final element order of the sorted sequence and apply that to a joined sequence (passed via the Join
parameter). For example, if the element at index-7 moved to index-3 in the main sequence due to sorting then in the joined sequence too the element at index-7 would move to index-3. The movement of all elements in the main sequence (post-sort) would be mirrored in the joined sequence. For this to work both the sequences must have the same length.
The Key
parameter can take a shard or group of shards to transform the sequence elements before they're compared for sorting. This transformation doesn't actually change the value of the elements in the final sorted sequence (it's used only for sort comparisons).
Sort
works only on sequences.
Any input to this shard is ignored and its output is the main sorted sequence.
See also
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
[info] [sample-wire] seq1: [1 3 5 8 9]
[info] [sample-wire] seq2: [9 8 5 3 1]
[info] [sample-wire] seq3: [9 8 5 3 1]
[info] [sample-wire] seq4: [1 3 5 8 9]
[info] [sample-wire] seqJ: [c d b e a]