dynamobi/dynamobi — Issue #691: [FRG-181] Type of window function avg() after SqlToRel conversion does not agree with the original Sql type
Author: dynamobi-build
Created: 2011-12-30 03:43:33+00:00
State: open
Labels: FRG, Sql2Rel

[reporter="rchen", created="Tue, 8 Aug 2006 12:49:49 -0500 (GMT-05:00)"]
set schema 'sales';

explain plan without implementation for

select avg(empno) over w1

from emps window w1 as (partition by deptno order by age rows 2 preceding);

Error: java.lang.AssertionError: Internal error: Conversion to relational algebra failed to preserve datatypes:

validated type:

RecordType(INTEGER EXPR$0) NOT NULL

converted type:

RecordType(BIGINT EXPR$0) NOT NULL

rel:

ProjectRel(EXPR$0=[CASE(=(COUNT($0) OVER (PARTITION BY $2 ORDER BY $6 ROWS 2 PRECEDING), 0), CAST(null):INTEGER, /(SUM($0) OVER (PARTITION BY $2 ORDER BY $6 ROWS 2 PRECEDING), COUNT($0) OVER (PARTITION BY $2 ORDER BY $6 ROWS 2 PRECEDING)))])

TableAccessRel(table=[[LOCALDB, SALES, EMPS]]) (state=,code=0)