On this Page

Snap type:

Transform


Description:

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.

Prerequisites:

None.


Support and limitations:None.
Account: 

Accounts are not used with this Snap.


Views:


InputThis Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
Error

This Snap has at most one document error view and produces zero or more documents in the view.


Settings

Label


Required. 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

Required. List of paths to sort on.

Sort path

Required. Paths to values in the document to sort on.

Example: $person.first_name

Sort order

Required. Order of sorting. The available options are:

  • global
  • ascending
  • descending

Default value: global

If you select the option global, the Sort order (Global) property becomes functional for the corresponding Sort path.


Sort order (Global)

Sort the specified values in ascending or descending order.
Default value: ascending

Null greater

If selected, null is considered greater than non-null values, and null values will be placed last when sorted in the ascending order.

  • If selected and Sort order is ascending, nulls appear at the end of the list.
  • If selected and Sort order is descending, nulls appear at the beginning of the list.
  • If not selected and Sort order is ascending, nulls appear at the beginning of the list.
  • If not selected and Sort order is descending, nulls appear at the end of the list.

Please note that an empty string is not considered as null and always smaller than non-empty strings.

Default value: Not Selected


Null-safe access

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.

Default value:  Selected (True)  


Maximum memory %

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.


Default value:  10


Examples