In this article:
Overview
This Snap sorts a document stream using its values in the order in which they show up in the sort path list. For example, if the sort paths are $first_name and $last_name, then the value at first_name will be used first when sorting.
This Snap uses temporary files to sort the input document streams and is limited by the size of the free disk space in a node. The Snap reads input documents and sorts them in a memory buffer. When the buffer size reaches a certain limit, it writes the data in the buffer into a temporary file, clears the buffer, and reads/sorts more input documents.
The minimum size of the memory buffer is 100MB. You can increase the value in the Maximum memory % field.
Snap Type
The Sort Snap is a Transform-type Snap that sorts the input document streams in the memory buffer.
Prerequisites
None.
Support for Ultra Pipelines
Does not in Ultra Pipelines.
Limitations and Known Issues
None.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| The Snap reads input documents and sorts them in a memory buffer. |
Output | Document |
|
| This Snap sorts a document stream which show up in the sort path list. |
Error | Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:
Learn more about Error handling in Pipelines. |
Snap Settings
Asterisk (*): Indicates a mandatory field.
Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
Expression icon ( ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
Add icon (): Indicates that you can add fields in the fieldset.
Remove icon (): Indicates that you can remove fields from the fieldset.
Field Name | Field Type | Description | |
---|---|---|---|
Label* Default value: Sort | String | The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. | |
Sort Paths* | You can provide the list of paths to sort on. | ||
Sort path* Default Value: None | String/Sugesstion | Paths of values in the document to sort on. | |
Sort order* Default value: global | Dropdown list | Order of sorting. The available options are:
If you select the option global, the Sort order (Global) property becomes functional for the corresponding Sort path. | |
Sort order (Global) Default value: ascending | Dropdown list | Sort the specified values in ascending or descending order. | |
Null greater Default value: Not Selected | Checkbox | If selected, null is considered greater than non-null values, and null values will be placed last when sorted in the ascending order.
Please note that an empty string is not considered as null and always smaller than non-empty strings. | |
Null-safe access Default value: Selected (True) | Checkbox | If selected, the Snap considers the values of non-existent or incorrect sort paths as null. If unselected, the Snap validates each input document to throw errors for non-existent or incorrect sort paths. Clearing this property will result in a lower performance. | |
Maximum memory % Default value: 10 | Integer | Enter the percentage of maximum used memory compared to the maximum system memory. Sort Snap uses this property value to compute the size of the internal memory buffer for the external merge sort. The minimum buffer size is set to 100MB. If multiple instances of Sort Snap might be simultaneously being executed in the same Snaplex and the system memory size is limited, it is strongly advised to keep this property value low. | |
Snap Execution | Dropdown list | Page lookup error: page "Anaplan Read" not found. If you're experiencing issues please see our Troubleshooting Guide. |
Temporary Files
During execution, data processing on Snaplex nodes occurs principally in-memory as streaming and is unencrypted. When larger datasets are processed that exceeds the available compute memory, the Snap writes Pipeline data to local storage as unencrypted to optimize the performance. These temporary files are deleted when the Snap/Pipeline execution completes. You can configure the temporary data's location in the Global properties table of the Snaplex's node properties, which can also help avoid Pipeline errors due to the unavailability of space. For more information, see Temporary Folder in Configuration Options.
Example:
Sorting Usernames in Ascending Order
The example Pipeline demonstrates how to sort the usernames in a CSV file in ascending order. The usernames in a CSV file are parsed as a document and sorted.
Configure the File Reader Snap with SampleCSV file with multiple records.
2. The CSV Parser Snap reads the CSV data from the input and parses and writes the document data to the output.
3. Configure the Sort Snap with the username to sort in ascending order.
4. The Sort Snap sorts the input data in ascending order.
Snap Pack History
Related Links