sortBy_#

swordfish.function.sortBy_()#

Sort a table in-place based on the specified columns and directions. If the table is a partitioned table, the sorting is conducted within each partition, not on the entire table.

This operation is executed in parallel if the table is a partitioned table and the parallel processing feature is enabled (when the configuration parameter localExcutors > 0).

Parameters:
  • table (Constant) – A table object. It can be a partitioned or unpartitioned in-memory table.

  • sortColumns (Constant) – A string scalar/vector indicating the columns based on which the table will be sorted. It can also be a piece of metacode with an expression.

  • sortDirections (Constant, optional) –

    A Boolean scalar/vector indicating the sorting directions for the sorting columns, by default DFLT.

    1 means ascending and 0 means descending. If sortColumns is a vector and sortDirections is a scalar, the sortDirections applies to all the sorting columns.