sliceByKey#

swordfish.function.sliceByKey()#

Get the rows containing the specified values of the key columns from a keyed table or an indexed table. It is faster than the corresponding SQL statement.

For a keyed table, rowKeys must contain values for all key columns.

For an indexed table, rowKeys must contain values for the first n key columns.

If colNames is not specified, return all columns.

The data form of the result depends on colNames. If colNames is a scalar, return a vector; if colNames is a vector, return an in-memory table.

Parameters:
  • table (Constant) – A keyed table or indexed table.

  • rowKeys (Constant) – A scalar/vector indicating the specified values of key columns.

  • colNames (Constant, optional) – A tring scalar/vector indicating the names of columns to be selected, by default DFLT.

  • preserveOrder (Constant, optional) – A Boolean scalar indicating whether the result should maintain the input order of rowKeys, by default DFLT.