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

Paul Jackson updated CALCITE-6126:
----------------------------------
    Description: 
The following {{RelMetadataTest}} test fails:

{{@Test void testOverNoPartitioning() {}}
{{  sql("select max(empno) over (rows between 2 preceding and 0 following) from 
emp")}}
{{    .assertThatAreColumnsUnique(bitSetOf(0), is(false))}}
{{    .assertThatUniqueKeysAre();}}
{{}}}

With this error:

{{java.lang.AssertionError: Conversion to relational algebra failed to preserve 
datatypes:}}
{{validated type:}}
{{RecordType(INTEGER EXPR$0) NOT NULL}}
{{converted type:}}
{{RecordType(INTEGER NOT NULL EXPR$0) NOT NULL}}
{{rel:}}
{{LogicalProject(EXPR$0=[MAX($0) OVER ()])}}
{{  LogicalTableScan(table=[[CATALOG, SALES, EMP]])}}
{{ at 
org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:507)}}
{{ at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:622)}}
{{ at 
org.apache.calcite.sql.test.AbstractSqlTester.convertSqlToRel2(AbstractSqlTester.java:541)}}
{{ at 
org.apache.calcite.sql.test.SqlTester.convertSqlToRel(SqlTester.java:291)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.sqlToRel(RelMetadataFixture.java:189)}}
{{ at 
org.apache.calcite.test.RelSupplier$SqlRelSupplier.apply2(RelSupplier.java:104)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.toRel(RelMetadataFixture.java:195)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.assertThatAreColumnsUnique(RelMetadataFixture.java:508)}}

 

  was:
The following {{RelMetadataTest}} test fails:

{{@Test void testOverNoPartitioning() {}}
{{  sql("select max(empno) over (rows between 2 preceding and 0 following) from 
emp")}}
{{    .assertThatAreColumnsUnique(bitSetOf(0), is(false))}}
{{    .assertThatUniqueKeysAre();}}
{{}}}

With this error:

{{java.lang.AssertionError: Conversion to relational algebra failed to preserve 
datatypes:}}
{{validated type:}}
{{RecordType(INTEGER EXPR$0) NOT NULL}}
{{converted type:}}
{{RecordType(INTEGER NOT NULL EXPR$0) NOT NULL}}
{{rel:}}
{{LogicalProject(EXPR$0=[MAX($0) OVER ()])}}
{{  LogicalTableScan(table=[[CATALOG, SALES, EMP]])}}
{{ at 
org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:507)}}
{{ at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:622)}}
{{ at 
org.apache.calcite.sql.test.AbstractSqlTester.convertSqlToRel2(AbstractSqlTester.java:541)}}
{{ at 
org.apache.calcite.sql.test.SqlTester.convertSqlToRel(SqlTester.java:291)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.sqlToRel(RelMetadataFixture.java:189)}}
{{ at 
org.apache.calcite.test.RelSupplier$SqlRelSupplier.apply2(RelSupplier.java:104)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.toRel(RelMetadataFixture.java:195)}}
{{ at 
org.apache.calcite.test.RelMetadataFixture.assertThatAreColumnsUnique(RelMetadataFixture.java:508)}}

 

The query parses without error if the expression is aliased:

{{@Test void testOverNoPartitioning() {}}
{{sql("select max(empno) over (rows between 2 preceding and 0 following) maxEmp 
from emp")}}
{{.assertThatAreColumnsUnique(bitSetOf(0), is(false))}}
{{.assertThatUniqueKeysAre();}}
{{}}}


> Return type check fails with OVER
> ---------------------------------
>
>                 Key: CALCITE-6126
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6126
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Paul Jackson
>            Priority: Major
>
> The following {{RelMetadataTest}} test fails:
> {{@Test void testOverNoPartitioning() {}}
> {{  sql("select max(empno) over (rows between 2 preceding and 0 following) 
> from emp")}}
> {{    .assertThatAreColumnsUnique(bitSetOf(0), is(false))}}
> {{    .assertThatUniqueKeysAre();}}
> {{}}}
> With this error:
> {{java.lang.AssertionError: Conversion to relational algebra failed to 
> preserve datatypes:}}
> {{validated type:}}
> {{RecordType(INTEGER EXPR$0) NOT NULL}}
> {{converted type:}}
> {{RecordType(INTEGER NOT NULL EXPR$0) NOT NULL}}
> {{rel:}}
> {{LogicalProject(EXPR$0=[MAX($0) OVER ()])}}
> {{  LogicalTableScan(table=[[CATALOG, SALES, EMP]])}}
> {{ at 
> org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:507)}}
> {{ at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:622)}}
> {{ at 
> org.apache.calcite.sql.test.AbstractSqlTester.convertSqlToRel2(AbstractSqlTester.java:541)}}
> {{ at 
> org.apache.calcite.sql.test.SqlTester.convertSqlToRel(SqlTester.java:291)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.sqlToRel(RelMetadataFixture.java:189)}}
> {{ at 
> org.apache.calcite.test.RelSupplier$SqlRelSupplier.apply2(RelSupplier.java:104)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.toRel(RelMetadataFixture.java:195)}}
> {{ at 
> org.apache.calcite.test.RelMetadataFixture.assertThatAreColumnsUnique(RelMetadataFixture.java:508)}}
>  



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

Reply via email to