A pseudocolumn behaves like a stream element, but is not actually part of the tuple.
You can select from pseudocolumns, but you cannot modify their values. A pseudocolumn is also similar to a function without arguments (see Section 1.1.9, "Functions").
Oracle CQL supports the following pseudocolumns:
The ELEMENT_TIME
pseudocolumn returns the timestamp value associated with a given stream element as a java.lang.Math.Bigint(Long)
.
For syntax, see pseudo_column::=.
Example 3-1 shows how you can use the
ELEMENT_TIME
pseudocolumn in a select statement. Stream S1
has schema (c1 integer)
. Given the input stream that Example 3-2 shows, this query returns the results that Example 3-3
shows. Note that the function
to_timestamp
is used to convert the Long
values to timestamp values.
Example 3-1 ELEMENT_TIME Pseudocolumn in a Select Statement
<query id="q4"><![CDATA[ select c1, to_timestamp(element_time) from S1[range 10000000 nanoseconds slide 10000000 nanoseconds] ]]></query>
Timestamp Tuple Kind Tuple 8000 + 80,12/31/1969 17:00:08 8010 - 80,12/31/1969 17:00:08 9000 + 90,12/31/1969 17:00:09 9010 - 90,12/31/1969 17:00:09 13000 + 130,12/31/1969 17:00:13 13010 - 130,12/31/1969 17:00:13 15000 + 150,12/31/1969 17:00:15 15010 - 150,12/31/1969 17:00:15 23000 + 230,12/31/1969 17:00:23 23010 - 230,12/31/1969 17:00:23 25000 + 250,12/31/1969 17:00:25 25010 - 250,12/31/1969 17:00:25
Example 3-4 shows how the
ELEMENT_TIME
pseudocolumn can be used in a pattern query. Here a tuple or event matches correlation variable Nth
if the value of Nth.status
is >= F.status
and if the difference between the Nth.ELEMENT_TIME
value of that tuple and the tuple that last matched F
is less than the given interval as a java.lang.Math.Bigint(Long)
.