Type of operation: Filter


Exclude rows from the input dataset that do not match the given predicate expression.

filter_last behaves identically to the verb filter except when the input is a Resource dataset. See the documentation of filter for more details.

When the input is a Resource dataset, cell values may change over time for a given row. In this case, filter_last will filter the rows based on their last value. When the input is a Resource dataset and the filter predicate refers to a column which is time-mutable, then filter_last is not accelerable. See verb set_col_immutable for more information on time-mutable and time-immutable columns. To make filter_last accelerable on a Resource dataset, consider instead using ever with a frame or first using set_col_immutable. Consider also first converting the Resource to an Event or Interval dataset using make_event or make_interval, upon which filter_last is accelerable.


filter_last predicate









Only one



filter_last is sometimes accelerable, depending on options used. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.


filter_last string(status_code) ~ /^5.*/

Keep only rows where the status_code column, converted to string, starts with “5”. For more simple examples, see the filter verb.

filter_last status="ON"

Where the input is a Resource dataset with a time-mutable column “status”, select the Resources whose last status during the query window was “ON”. This example is not accelerable.

filter_last server_id>100

Suppose the input is a Resource dataset describing many servers and how their statuses change over time. In this example, the primary key of the input Resource is the column “server_id”, and this column is time-immutable. This example would select the servers whose server_id is greater than 100. This example is accelerable because for a given server, its server_id cannot change over time.