[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-11 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928130#comment-16928130
 ] 

Rui Wang commented on CALCITE-3340:
---

By treating TUMBLE the same as OTHER_FUNCTION during registration, and remove 
DESCRIPTOR because we haven't decided how to support it, I ended with an 
exception:

Cannot apply 'TUMBLE' to arguments of type 'TUMBLE(, )'. 
Supported form(s): 'TUMBLE(, )'
'TUMBLE(, , )

This is understandable and the resolution seems to be a new signature  for 
TUMBLE to allow RECORDTYPE as the first parameter.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-12 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928595#comment-16928595
 ] 

Julian Hyde commented on CALCITE-3340:
--

It seems that {{TUMBLE}} should be a built-in table function, defined in 
{{SqlStdOperatorTable}}. I'd assign it (and {{HOP}}) values in {{enum 
SqlKind}}, because we may need special-case logic for it.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-12 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928836#comment-16928836
 ] 

Rui Wang commented on CALCITE-3340:
---

This is a pretty important moment so I will confirm more details:

1. Calcite will need maintain both GROUP BY TUMBLE and FROM TABLE(TUMBLE).
2. Sqlkind has already had TUMBLE, HOP, SESSION and their start and end.
3. Because Parser.jj does not have dedicated match for TUMBLE/HOP/SESSION, 
these functions will be UnresolvedFunction after parsing.  In validator, there 
will be a unresolved function lookup from operator table to find operators by 
operator name, and operator names should be unique. See 
[SqlValidatorImpl.java#L1750|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1750]

Thus I believe the recommendation for table-value function TUMBLE is:
1. a new operator defined in SqlStdOperatorTable.
2. The new operator will have a static instance with another variable name, 
e.g. TUMBLE_TABLE_FUNCTION.  It's because 
[TUMBLE|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L2255]
 is already defined.
3. The real query syntax for table-value function TUMBLE will also have to be 
changed to: "SELECT * FROM TABLE(TUMBLE_TABLE_FUNCTION(...))". This is because 
of the operator name lookup mentioned above so we have to differentiate TUMBLE 
and TUMBLE_TABLE_FUNCTION.

 
Any comment on my summary?



> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-12 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928911#comment-16928911
 ] 

Rui Wang commented on CALCITE-3340:
---

Actually by the idea above(with a slight modification), I was able to quickly 
prototype to pass validator and generate a logical plan as the following string 
format:


{code:java}
LogicalProject(ROWTIME=[$0], ID=[$1], PRODUCT=[$2], UNITS=[$3], wstart=[$4], 
wend=[$5])
  LogicalTableFunctionScan(invocation=[TUMBLE_TABLE_FUNCTION($3, 6:INTERVAL 
MINUTE)], rowType=[RecordType(TIMESTAMP(0) ROWTIME, INTEGER ID, VARCHAR(10) 
PRODUCT, INTEGER UNITS, TIMESTAMP(0) wstart, TIMESTAMP(0) wend)])
{code}

Apparently there should be LogicalProject generated as an input for 
LogicalTableFunctionScan, which I will further investigate. 

I feel like it's a good progress so far. LogicalTableFunctionScan has a return 
type with two new fields appended: wstart and wend 



> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-12 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16929003#comment-16929003
 ] 

Rui Wang commented on CALCITE-3340:
---

I was finally able to create the following plan:

{code:java}
LogicalProject(ROWTIME=[$0], ID=[$1], PRODUCT=[$2], UNITS=[$3], wstart=[$4], 
wend=[$5])
  LogicalTableFunctionScan(invocation=[TUMBLE_TABLE_FUNCTION($3, 6:INTERVAL 
MINUTE)], rowType=[RecordType(TIMESTAMP(0) ROWTIME, INTEGER ID, VARCHAR(10) 
PRODUCT, INTEGER UNITS, TIMESTAMP(0) wstart, TIMESTAMP(0) wend)])
LogicalProject(ROWTIME=[$0], ID=[$1], PRODUCT=[$2], UNITS=[$3])
  LogicalTableScan(table=[[ORINOCO, ORDERS]])
{code}

It raises a further question: is current LogicalTableFunctionScan good enough 
for table function windowing? I will create another JIRA to discuss this.


> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-13 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16929597#comment-16929597
 ] 

Julian Hyde commented on CALCITE-3340:
--

I think you need new TUMBLE and HOP functions. Is it possible to keep the old 
ones and add new ones? The old ones probably don't need to be visible in the 
operator table, because calls to them are created by the parser (explicitly) 
rather than by the validator (looking up by name).

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-16 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930758#comment-16930758
 ] 

Rui Wang commented on CALCITE-3340:
---

[~julianhyde]

Could you please give some feedback on this prototype PR directly: 
https://github.com/apache/calcite/pull/1457? I am a little confused on old/new 
operators suggestions/questions.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-16 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930783#comment-16930783
 ] 

Julian Hyde commented on CALCITE-3340:
--

Well, the PR doesn't do quite what the JIRA case promises. You've added a table 
function called "TUMBLE_TABLE_FUNCTION" not "TUMBLE".

I see a couple of spurious changes in formatting, and a lot of classes, methods 
and fields added with no javadoc. Without javadoc it's difficult to know the 
intent of this code.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-16 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930789#comment-16930789
 ] 

Rui Wang commented on CALCITE-3340:
---

"TUMBLE_TABLE_FUNCTION" was a quick decision to skip some changes in validator. 

Ok, the next I will do is:
1. change "TUMBLE_TABLE_FUNCTION" back to "TUMBLE" (and more changes in 
validator)
2. correct formatting.
3. more javadoc/comments to explain the code.

After this is done I will let you know.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-16 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930838#comment-16930838
 ] 

Julian Hyde commented on CALCITE-3340:
--

I don't really understand any of this case. Let's start with the first line, 
"COLLECTION_TABLE(TABLE syntax)". "COLLECTION_TABLE" isn't a keyword in SQL, so 
I'm totally confused.

Then the description starts talking about code, e.g. what particular lines of 
SqlValidatorImpl are doing or should be doing.

Can we start with a goal, e.g. a particular SQL query that we wish to be able 
to run, and the results it should give.

> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (CALCITE-3340) Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in validator

2019-09-16 Thread Rui Wang (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930845#comment-16930845
 ] 

Rui Wang commented on CALCITE-3340:
---

I see. Thanks for bringing it up.

To clarify, I am aiming to generate a logical plan for the following query by 
PlannerImpl:

SELECT *
FROM TABLE(TUMBLE(
TABLE ORDERS,
INTERVAL '10' MINUTE))


This SQL query does not have DESCRIPTOR included, which is being tracked and 
discussed by CALCITE-3339.


I expect we should generate a logical plan from this query that is similar to 
the following:


{code:java}
LogicalProject(ROWTIME=[$0], ID=[$1], PRODUCT=[$2], UNITS=[$3], wstart=[$4], 
wend=[$5])
  LogicalTableFunctionScan(invocation=[TUMBLE($3, 6:INTERVAL MINUTE)], 
rowType=[RecordType(TIMESTAMP(0) ROWTIME, INTEGER ID, VARCHAR(10) PRODUCT, 
INTEGER UNITS, TIMESTAMP(0) wstart, TIMESTAMP(0) wend)])
LogicalProject(ROWTIME=[$0], ID=[$1], PRODUCT=[$2], UNITS=[$3])
  LogicalTableScan(table=[[ORINOCO, ORDERS]])
{code}




> Make TUMBLE be accepted as an operand for COLLECTION_TABLE(TABLE syntax) in 
> validator
> -
>
> Key: CALCITE-3340
> URL: https://issues.apache.org/jira/browse/CALCITE-3340
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: Rui Wang
>Assignee: Rui Wang
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> For query:
> SELECT *
> FROM TABLE(TUMBLE(
> TABLE ORDERS,
> DESCRIPTOR(ROWTIME),
> INTERVAL '10' MINUTE))
> (note reuse TUMBLE operator than use a new unresolved one)
> Calcite validator will does a step to do registration and 
> "TABLE(TUMBLE(...))" will hit [1], where "TUMBLE(...)" will be passed to [2] 
> again but there is no matching  Sqlkind handling for "TUMBLE" (note that 
> TUMBLE's node kind is TUMBLE). 
> It seems we should support TUMBLE in [2]. The details of how to support it 
> needs a bit more discussion and prototyping.
> [1]: 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2244
> [2]:https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2031



--
This message was sent by Atlassian Jira
(v8.3.2#803003)