You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/10/09 17:07:00 UTC

[jira] [Updated] (CALCITE-6604) Add support for SqlWindowTableFunction in RelToSql Converter

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

ASF GitHub Bot updated CALCITE-6604:
------------------------------------
    Labels: pull-request-available  (was: )

> 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
>
> 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)