into_values()
Returns the data accumulated in a state aggregate.
2. into_values (
4. agg [StateAgg | TimelineAgg]
6. ) RETURNS (TEXT, BIGINT)
8. into_int_values (
10. agg [StateAgg | TimelineAgg]
12. ) 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
| Name | Type | Description |
|---|---|---|
agg |
StateAgg or TimelineAgg |
The aggregate to display data for |
Returns
| Column | Type | Description |
|---|---|---|
state |
TEXT |
A state found in the StateAgg or TimelineAgg |
duration |
BIGINT or INT |
The 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:
2. SELECT state, duration FROM toolkit_experimental.into_values(
4. (SELECT toolkit_experimental.state_agg(time, state) FROM states_test));
Example output:
2. state | duration
4. ------+-----------
6. ERROR | 3000000
8. OK | 106000000
10. START | 11000000
