Group Key
Sometimes you need to select fields that will create a grouping key. This can be done in the Edit key dialog. After opening the dialog, you need to select the fields that should create the group key.
Select the fields you want and drag and drop each of the selected key fields to the Key parts pane on the right. (You can also use the Arrow buttons.)
After selecting the fields, you can click the OK button and the selected field names will turn to a sequence of the same field names separated by a semicolon. This sequence can be seen in the corresponding attribute row.
The resulting group key is a sequence of field names separated by a semicolon.
It looks like this: FieldM;…FieldN
.
In this kind of key, no sort order is shown unlike in Sort key. By default, the order is ascending for all fields and priority of these fields descends down from top in the dialog pane and to the right from the left in the attribute row. For more detailed information, see Sort Key.
When a key is defined and used in a component, input records are gathered together into a group of the records with equal key values.
Ordering Type
The key is ordered in following ways:
-
Ascending - if the input records are sorted in ascending order
-
Descending - if the input records are sorted in descending order
-
Auto - the sorting order of the input records is guessed from the first two records with different value in the key field, i.e., from the first records of the first two groups.
-
Ignore - if the input records with the same key field value(s) are not sorted
Group key is used in the following components:
-
Group key in SortWithinGroups
-
Merge key in Merge
-
Partition key in Partition, and ParallelPartition
-
Aggregate key in Aggregate
-
Key in Denormalizer
-
Group key in Rollup
-
Also Partition key that serves for distributing data records among different output ports (or Cluster nodes in case of clusterpartition) is of this type. See Partitioning Output into Different Output Files