Hi,
  It makes sense to me.
  Thanks for the introductions.

Best,
Jiayi Liao


Original Message
Sender:Dawid [email protected]
Recipient:[email protected]; [email protected]; Julian 
[email protected]
Date:Monday, Dec 17, 2018 16:52
Subject:Re: Problems about subsets clause order for MATCH_RECOGNIZE


Hi Jiayi,
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[1]. 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.
Best,
Dawid



[1] 
https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip

On 17/12/2018 04:52, bupt_ljy wrote:

Hi Dawid,
 The elements’s order in SUBSET clause is consistent with the order in PATTERN, 
is this what you mean?
 
 Let me take an example:  SUBSET X=(A,B)


 I’m not 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”.


Best,
Jiayi Liao


Original Message
Sender:Dawid [email protected]
Recipient:[email protected]; Julian [email protected]; 
[email protected]
Date:Sunday, Dec 16, 2018 20:08
Subject:Re: Problems about subsets clause order for MATCH_RECOGNIZE


Hi Jiayi, 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. Best, Dawid 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 
[email protected] 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?      Best,  Jiayi Liao

Reply via email to