[ 
https://issues.apache.org/jira/browse/CALCITE-6604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongsheng He updated CALCITE-6604:
----------------------------------
    Description: 
Converting the `RelNode` with `SqlWindowTableFunction` will fail with exception:

For example the employee table:

 
{code:java}
  Column   |              Type              |
-----------+-------------------------------
 id             | integer                   | 
 salary      | double precision             |  
 hire_rate | timestamp(0) without time zone |
 
{code}
and the sql:
{code:java}
SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL '1' 
MINUTE)){code}
Conver it to RelNode like this:
{code:java}
LogicalProject
|
| -- inputs:               <-----------    
|     |--- LogicalTableScan           |    
|                                     |    
|-- RexCall:                          |    
|    |- op: SqlWindowFunction         |    
|    |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]   
|
|--- fieldList [`id`, `salary`, `hire_date`, `window_start`, `window_end`]{code}
When convert the RelNode to SqlNode, the operand( INPUT_REF(2))  of operator 
`DESCRIPTOR` incorrectly refers to the  RelNode (TableScan) in current 
implemention,  it should refer to input rows:
{code:java}
LogicalProject
|- 
| -- inputs: 
|      |--- LogicalTableScan 
|     
|-- RexCall: 
|     |- op: SqlWindowFunction  
|     |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]
|                                        |
|                                        |
|                                        \/
|--- fieldList [`id`, `salary`,  `hire_date`, `window_start`, `window_end`] 
{code}
 

  was:
Converting the `RelNode` with `SqlWindowTableFunction` will fail with exception:

For example the employee table:

 

 

 
{code:java}
  Column   |              Type              |
-----------+-------------------------------
 id             | integer                   | 
 salary      | double precision             |  
 hire_rate | timestamp(0) without time zone |
 
{code}
and the sql:
{code:java}
SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL '1' 
MINUTE)){code}
Conver it to RelNode like this:
{code:java}
LogicalProject
|
| -- inputs:               <-----------    
|     |--- LogicalTableScan           |    
|                                     |    
|-- RexCall:                          |    
|    |- op: SqlWindowFunction         |    
|    |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]   
|
|--- fieldList [`id`, `salary`, `hire_date`, `window_start`, `window_end`]{code}
When convert the RelNode to SqlNode, the operand( INPUT_REF(2))  of operator 
`DESCRIPTOR` incorrectly refers to the  RelNode (TableScan) in current 
implemention,  it should refer to input rows:
{code:java}
LogicalProject
|- 
| -- inputs: 
|      |--- LogicalTableScan 
|     
|-- RexCall: 
|     |- op: SqlWindowFunction  
|     |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]
|                                        |
|                                        |
|                                        \/
|--- fieldList [`id`, `salary`,  `hire_date`, `window_start`, `window_end`] 
{code}
 

 


> Add support for SqlWindowTableFunction in RelToSql Converter
> ------------------------------------------------------------
>
>                 Key: CALCITE-6604
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6604
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>            Reporter: Dongsheng He
>            Assignee: Dongsheng He
>            Priority: Minor
>
> Converting the `RelNode` with `SqlWindowTableFunction` will fail with 
> exception:
> For example the employee table:
>  
> {code:java}
>   Column   |              Type              |
> -----------+-------------------------------
>  id             | integer                   | 
>  salary      | double precision             |  
>  hire_rate | timestamp(0) without time zone |
>  
> {code}
> and the sql:
> {code:java}
> SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL 
> '1' MINUTE)){code}
> Conver it to RelNode like this:
> {code:java}
> LogicalProject
> |
> | -- inputs:               <-----------    
> |     |--- LogicalTableScan           |    
> |                                     |    
> |-- RexCall:                          |    
> |    |- op: SqlWindowFunction         |    
> |    |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]   
> |
> |--- fieldList [`id`, `salary`, `hire_date`, `window_start`, 
> `window_end`]{code}
> When convert the RelNode to SqlNode, the operand( INPUT_REF(2))  of operator 
> `DESCRIPTOR` incorrectly refers to the  RelNode (TableScan) in current 
> implemention,  it should refer to input rows:
> {code:java}
> LogicalProject
> |- 
> | -- inputs: 
> |      |--- LogicalTableScan 
> |     
> |-- RexCall: 
> |     |- op: SqlWindowFunction  
> |     |- operands: [DESCRIPTOR(INPUT_REF(2)), INTERVAL]
> |                                        |
> |                                        |
> |                                        \/
> |--- fieldList [`id`, `salary`,  `hire_date`, `window_start`, `window_end`] 
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to