Rather than slicing horizontally (into tasks each in a different area of the code), let's slice vertically and do a spike for the stupidest, simplest example. I propose that we do enough to implement this example from here and nothing more:
from tkrfid_ItemTempStream MATCH_RECOGNIZE (
PARTITION BY itemId
MEASURES A.itemId as itemId
PATTERN (A B* C)
A AS (A.temp >= 25),
B AS ((B.temp >= 25) and (to_timestamp(B.element_time) - to_timestamp(A.element_time) < INTERVAL "0 00:00:05.00" DAY TO SECOND)),
C AS (to_timestamp(C.element_time) - to_timestamp(A.element_time) >= INTERVAL "0 00:00:05.00" DAY TO SECOND)
) as its
But let's make it even dumber if we can. There's a lot that we don't know we don't know, and we will only find it when we go end-to-end. It don't want you to build a lot of SQL grammar (and other stuff) and have to tear it down.
Also let's stick to standard SQL lexical norms, like single-quotes around intervals, double-quotes to quote identifiers. In other words, use what is already defined in Parser.jj, such as SimpleIdentifier() and IntervalLiteral().
And let's write this only in terms of tables, not streams, at first. It will be much easier to test that way.