into_values()

Returns the data accumulated in a state aggregate.

  1. into_values (
  2. agg [StateAgg | TimelineAgg]
  3. ) RETURNS (TEXT, BIGINT)
  4. into_int_values (
  5. agg [StateAgg | TimelineAgg]
  6. ) RETURNS (INT, BIGINT)
warning

Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.

Required arguments

NameTypeDescription
aggStateAgg or TimelineAggThe aggregate to display data for

Returns

ColumnTypeDescription
stateTEXTA state found in the StateAgg or TimelineAgg
durationBIGINT or INTThe duration of time spent in that state

Sample usage

Create a state aggregate from the table states_test. The time column is named time, and the state column contains text values corresponding to different states of a system. Use into_values to display the data from the state aggregate:

  1. SELECT state, duration FROM toolkit_experimental.into_values(
  2. (SELECT toolkit_experimental.state_agg(time, state) FROM states_test));

Example output:

  1. state | duration
  2. ------+-----------
  3. ERROR | 3000000
  4. OK | 106000000
  5. START | 11000000