[
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
{code:java}
SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL '1'
MINUTE)){code}
RelNode like this:
{color:#ce9178}LogicalProject{color}
{color:#cccccc}
{color}{color:#c586c0}|{color}{color:#569cd6}-{color}{color:#f44747} {color}
{color:#ce9178} | -- inputs: <-----------{color}
{color:#ce9178} | |--- LogicalTableScan |{color}
{color:#ce9178} | |{color}
{color:#ce9178} -- RexCall: |{color}
{color:#ce9178} | op: SqlWindowFunction |{color}
{color:#ce9178} | operands: [DESCRIPTOR(INPUT_REF(3)), INTERVAL]{color}
{code:java}
{code}
The cause of this issue is:
{code:java}
visit(TableFunctionScan e) {
...
final Context context = tableFunctionScanContext(inputSqlNodes);
...
}{code}
`tableFunctionScanContext` only refer `inputSqlNodes` to fields, when handle
`DESCRIPTOR(hire_date)`, the `hire_date` is a `RexInputRef` with index 3, but
there is only one field (`inputSqlNodes`) , it cause a
IndexOutOfBoundsException.
was:
Converting the `RelNode` with `SqlWindowTableFunction` will fail with exception:
For example:{{{{}}{}}}
{code:java}
SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL '1'
MINUTE)){code}
{code:java}
java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 1
at
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at
java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$TableFunctionScanContext.field(SqlImplementor.java:1671)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:654)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:1130)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.callToSql(SqlImplementor.java:830)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:803)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:1130)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.callToSql(SqlImplementor.java:830)
at
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:803)
at
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:1295)
{code}
The cause of this issue is:
{code:java}
visit(TableFunctionScan e) {
...
final Context context = tableFunctionScanContext(inputSqlNodes);
...
}{code}
`tableFunctionScanContext` only refer `inputSqlNodes` to fields, when handle
`DESCRIPTOR(hire_date)`, the `hire_date` is a `RexInputRef` with index 3, but
there is only one field (`inputSqlNodes`) , it cause a
IndexOutOfBoundsException.
> 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
> {code:java}
> SELECT * FROM TABLE(TUMBLE(TABLE employee, DESCRIPTOR(hire_date), INTERVAL
> '1' MINUTE)){code}
> RelNode like this:
> {color:#ce9178}LogicalProject{color}
> {color:#cccccc}
> {color}{color:#c586c0}|{color}{color:#569cd6}-{color}{color:#f44747} {color}
> {color:#ce9178} | -- inputs: <-----------{color}
> {color:#ce9178} | |--- LogicalTableScan |{color}
> {color:#ce9178} | |{color}
> {color:#ce9178} -- RexCall: |{color}
> {color:#ce9178} | op: SqlWindowFunction |{color}
> {color:#ce9178} | operands: [DESCRIPTOR(INPUT_REF(3)), INTERVAL]{color}
>
> {code:java}
> {code}
>
>
> The cause of this issue is:
> {code:java}
> visit(TableFunctionScan e) {
> ...
> final Context context = tableFunctionScanContext(inputSqlNodes);
> ...
> }{code}
> `tableFunctionScanContext` only refer `inputSqlNodes` to fields, when handle
> `DESCRIPTOR(hire_date)`, the `hire_date` is a `RexInputRef` with index 3,
> but there is only one field (`inputSqlNodes`) , it cause a
> IndexOutOfBoundsException.
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)