not sure what you mean by elements' order in SUBSET, so I'd try
to rephrase it. What I mean is that the order of pattern variables
in SUBSET clause does not matter. User can put them in whatever
order he/she likes. LAST/FIRST etc. will account for the order in
PATTERN clause. So in general (SUBSET X = (A,B)) = (SUBSET X =
(B,A)). This is my understanding from. Also it would be nice to
actually verify this behavior with ORACLE.
Can not tell anything about concrete implementation decisions
though. Don't know why sortedSet was used there.
On 17/12/2018 04:52, bupt_ljy wrote:
elements’s order in SUBSET clause is consistent with the order
in PATTERN, is this what you mean?
take an example: SUBSET X=(A,B)
very sure about the implementations of Oracle, but I’m curious
that why we use sortedSet to store the elements(A,B) of SUBSET
if we don’t need the “sorted”.
Date: Sunday, Dec 16,
Subject: Re: Problems about
subsets clause order for MATCH_RECOGNIZE
I don't think it should any difference what is the order in the SUBSET
clause. The PATTERN clause specifies the definitive order of pattern
variables. SUBSET clause just groups them as a single entity you can
reference. Therefore LAST/FIRST/PREV/NEXT/AFTER MATCH etc. will take
into account only order in the PATTERN clause.
On 16/12/2018 08:07, Julian Hyde wrote:
> I don’t understand MATCH_RECOGNIZE well enough to give an opinion. Is there a query that gives different results on Oracle if you change the order of items in SUBSET?
> It seems that the parser preserves the order of items in the subset, but the SqlToRelConverter does not, hence the line "subsets=[[[DOWN, STRT]]” in SqlToRelConverterTest.xml. I would be concerned if the parser re-ordered things, but I am not too concerned about SqlToRelConverter unless the semantics are wrong.
>> On Dec 14, 2018, at 12:37 AM, bupt_ljy <bupt_ljy@xxxxxxx> wrote:
>> Hi all,
>> It’s my first time to send emails to Calcite developers. It’s a really good project and many projects benefit from it.
>> Now I’ve encountered a problem about the subsets for MATCH_RECOGNIZE in thetestMatchRecognizeSubset1() testing. From the results, I can tell that"subset stdn = (strt, down)"will be explained to "SUBSET \"STDN\" = (\"DOWN\", \"STRT\”)”, which confuses me. IMO, It’ll affect the result of functions like“FIRST” and“LAST”, which may not be what I want, although it works fine with“AVG” function.
>> I’m not sure if this is a bug, or anyone can tell me how we arrive here?
>> Jiayi Liao