Top k Row Filter

The node behaves the same as a combination of the Sorter node followed by a Row Filter that only keeps the first k rows of the table except for the order of the rows which depends on the Output order settings. Note, however, that the implementation of this node is more efficient then the node combination above. In the dialog, select the columns according to which the data should be selected. For each column you can also specify whether a larger or smaller value is considered as superior.

Options

Sorting
A list of sorting criteria.
  • Column: Sort rows by the values in this column. If you set multiple sorting criteria, the table is sorted by the first criterion. The following criteria are only considered, if the comparison by all previous criteria results in a tie.
  • Order: Specifies the sorting order:
    • Ascending: The smallest or earliest value in the order will appear at the top of the list. For example, for numbers this will sort the values from smallest to largest; for dates this will sort the values from oldest to most recent date.
    • Descending: The largest or latest value in the order will appear at the top of the list. For example, for numbers this will sort the values from largest to smallest; for dates this will sort the values from most recent to oldest date.
  • String comparison: Specifies which type of sorting to apply to the strings:
    • Natural: Natural sort order is applied. Sorts strings by treating the numeric parts of a string as one character. For example, results in sort order “'Row1', 'Row2', 'Row10'”.
    • Lexicographic: Lexicographic sort order is applied. Sorts strings by comparing character-by-character. For example, results in sort order “'Row1', 'Row10', 'Row2'”.
  • Value comparison: Specifies whether string-compatible values (such as date/time values) are compared by their typed value or by their string representation. Sorting by value (type-specific) uses the native data type comparator. This usually matches user expectations.
    • Value (type-specific): Compares values using their native data type comparator, which usually matches user expectations. For example, date/time values are sorted chronologically.
    • String representation (natural): Compares values by their string representation. “Natural sort order” is applied, so sequences of digits are interpreted as one number. For example, results in sort order “'File1.txt', 'File2.txt', 'File100.txt'”. Note that the textual form of non-String values (e.g., date/time values) may not sort in an expected order.
Sort missing values to end
If selected, missing values are always considered to be smaller to present cells.
Fail on empty input table
If selected, and this node encounters an input table with zero rows, it will fail.
Filter mode
Specifies the mode for the top k selection of the output
  • Rows: Returns the top k rows based on their first occurrence in the input table.
  • Unique values: Returns all rows associated with the top k unique values.
Number of rows / unique values
The number of rows to select from the input table based on the specified mode.
Output order
Depending on the settings of the algorithm the order might change in the output and this option allows you to specify constraints on the order.
  • Sorted: The rows in the output are sorted according to the specified selection criteria.
  • Input order: The input order is reestablished for the rows returned by the algorithm. This requires sorting the output table.
  • Arbitrary: The rows are directly output in the order they are returned in by the algorithm. This option doesn't incur any additional runtime costs. Note: It is possible but not guaranteed that the output order is the same as the input order

Input Ports

Icon
Table to select rows from.

Output Ports

Icon
A table containing the top k rows.

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.