zzwqqq commented on code in PR #5210:
URL: https://github.com/apache/calcite/pull/5210#discussion_r3869470531
##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -4934,6 +4934,11 @@ private RexNode convertIdentifier(
String pv = null;
if (bb.isPatternVarRef && identifier.names.size() > 1) {
pv = identifier.names.get(0);
+ // A qualifier that is not a declared pattern variable denotes the
universal variable "*".
+ if (bb.scope instanceof MatchRecognizeScope
+ && !((MatchRecognizeScope) bb.scope).getPatternVars().contains(pv)) {
Review Comment:
Would this be handled correctly if the input table alias has the same name
as a pattern variable? For example:
```
FROM a_source AS A
MATCH_RECOGNIZE (
MEASURES commission AS c
PATTERN (A B)
DEFINE
A AS A.empid >= 0,
B AS B.empid < 0
)
```
Here, `A` is both the input table alias and a pattern variable. I am not
sure whether Calcite considers this case valid.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]