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

Mihai Budiu resolved CALCITE-6604.
----------------------------------
    Fix Version/s: 1.39.0
       Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/efa4d44bb61e80568b18844feb7838f162936dc8
Thank you for the contribution, [~ehds]

> 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
>              Labels: pull-request-available
>             Fix For: 1.39.0
>
>
> 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