ExtSort sorts input records according to a sort key.
|Component||Same input metadata||Sorted inputs||Inputs||Outputs||Java||CTL||Auto-propagated metadata|
|Input||0||for input data records||the same input and output metadata|
|Output||0||for sorted data records|
|1-N||for sorted data records|
This component has one input port and at least one output port.
If more output ports are connected, ExtSort sends each record to all connected output ports.
Metadata can be propagated through this component. All output metadata must be same as the input metadata. ExtSort does not change metadata.
|Sort key||Key according to which the records are sorted. For more information, see Sort Key.||name(a);age(d)|
The maximum number of records parsed in memory. If there are more input records than this number, external sorting is performed.
|8000 (default) | 1-N|
|Number of tapes||The number of temporary files used to perform external sorting. Even number higher than 2.||6 (default) | 2*(1-N)|
Order of sorting (
|Ascending (default) | Descending|
|Sorting locale||Locale that should be used for sorting.||none (default) | any locale|
In the default setting of Case sensitive (
The Case sensitive attribute value is taken into account only if Locale is set.
|true (default) | false|
|Sorter initial capacity||does the same as Buffer capacity||8000 (default) | 1-N|
ExtSort receives data records through the single input port, sorts them according to a specified sort key and copies each of them to all connected output ports.
The Sort key is defined by one or more input fields
and the sorting order (ascending or descending) for each field.
The resulting sequence also depends on the key field type:
string fields are sorted in ASCIIbetical order
while other fields are sorted alphabetically.
In ascending order, null values are sorted before strings, numbers, booleans or dates. If you sort data in descending order, null values are sorted after strings, numbers, booleans or dates.
Remember that ExtSort processes records
in which the same fields of the Sort key attribute have
as if these
nulls were equal.
|Sorting according to a single field|
|Sorting according to multiple fields|
|Sorting with locale|
This example shows the basic usage of ExtSort.
Input records contains file names and their size. Sort the files according to their size starting with the biggest one.
file.txt | 2048 file.docx | 1048576 file.xml | 65536
In ExSort, set Sort key attribute: drag the field name from the left list to the right one and change Order to Descending.
The result would be:
file.docx | 1048576 file.xml | 65536 file.txt | 2048
This example shows sorting values according to a multiple-part key.
Each record contains first name, last name and year of birth. Sort the records according to all three fields. Sort the records according to last name and first name in ascending order. If there are more records with the same first and last name, the youngest one should be the first.
Jane | Doe | 1843 John | Doe | 1798 John | Doe | 1859
Set the Sort key attribute. In the dialog to define the key. The first part of the key (last name) should be on the top of the list on the right side. The first name should be the second and the year of birth should be the last one.
The result would be:
Jane | Doe | 1843 John | Doe | 1859 John | Doe | 1798
This example shows sorting records with locale.
Input records contains a list of French words. Sort the words according to the French collation.
parler être aller
In ExtSort, set Sort key and Sorting locale attributes.
The result will be:
aller être parler
Without the proper sorting locale, the result would be aller, parler, être.