The short answer is “yes”.
In the streaming SQL specification, the timestamp column does not have to be
called ROWTIME, does not have to be a timestamp, does not have to be strictly
ascending. You can aggregate by any quasi-monotonic value. ("Quasi-monotonic"
includes strictly ascending, ascending within a window (say, records are within
1 hour of being sorted), or if the system or producer promises to provide
watermarks.)
But to be clear, that’s the specification. Calcite’s current implementation of
the specification is not perfect, so you may find bugs.
Did you really mean that ts is a double? It looks like a long (i.e. 64 bit
integer). I wouldn’t recommend using floating-point numbers for timestamps,
because systems such as JSON parsers tend to mangle them, and subtraction is
lossy.
Julian
> On Jun 30, 2016, at 10:24 AM, Qiaochu Liu <[email protected]> wrote:
>
> Dear developers,
>
> I have a input Stream Topic which has the following message. I want to
> execute complex SQL query ( group by and sliding window ) on top of this
> topic.
>
>
>> "{'uuid': 'uuid1', 'ts': 1461780508, 'msg': {'booleanField': true,
>> 'doubleField': 1.1, 'longField': 1, 'intField': null}}"
>> "{'uuid': 'uuid1', 'ts': 1461780608, 'msg': {'booleanField': true,
>> 'doubleField': 1.1, 'longField': 1, 'intField': null}}"
>>
> In this message, "ts" is a double value which represent "timestamp", I wonder
> if it is possible to make the "ts" field working as "rowtime" in Calcite
> Streaming SQL examples, so that I can execute GROUP BY and WINDOW query on it?
>
> Sorry I don't know how to subscribe the developer maillist, can you give me
> some hint?
>
> Best regards,
> Qiaochu
>