dynamobi/dynamobi — Issue #818: [FRG-52] agg(numeric) fails if numeric type is nullable
Author: dynamobi-build
Created: 2011-12-30 03:50:37+00:00
State: open
Labels: FRG

[reporter="schoi", created="Tue, 21 Feb 2006 00:35:00 -0500 (GMT-05:00)"]
Repro:

----------

create schema s;

set schema 's';

create table t(i int primary key, n numeric (8,0));

insert into t values(1,1);

select floor(n/10) from t;

Error:

---------

Error: java.lang.AssertionError: Type mismatch:

rel rowtype:

RecordType(DECIMAL(19, 0) EXPR$0) NOT NULL

equivRel rowtype:

RecordType(DECIMAL(19, 0) NOT NULL EXPR$0) NOT NULL (state=,code=0)

net.sf.farrago.util.FarragoUtil$FarragoSqlException: java.lang.AssertionError: Type mismatch:

rel rowtype:

RecordType(DECIMAL(19, 0) EXPR$0) NOT NULL

equivRel rowtype:

RecordType(DECIMAL(19, 0) NOT NULL EXPR$0) NOT NULL

at org.eigenbase.relopt.RelOptUtil.equal(RelOptUtil.java:873)

at com.disruptivetech.farrago.volcano.VolcanoPlanner.register(VolcanoPlanner.java:476)

at com.disruptivetech.farrago.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:88)

at org.eigenbase.rel.ReduceDecimalsRule.onMatch(ReduceDecimalsRule.java:174)

at com.disruptivetech.farrago.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:127)

at com.disruptivetech.farrago.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:422)

at org.eigenbase.oj.stmt.OJPreparingStmt.optimize(OJPreparingStmt.java:281)

at net.sf.farrago.query.FarragoPreparingStmt.optimize(FarragoPreparingStmt.java:593)

at org.eigenbase.oj.stmt.OJPreparingStmt.prepareSql(OJPreparingStmt.java:255)

at net.sf.farrago.query.FarragoPreparingStmt.prepare(FarragoPreparingStmt.java:238)

at net.sf.farrago.db.FarragoDatabase$2.initializeEntry(FarragoDatabase.java:640)

at net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:157)

at net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:650)

at net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:530)

at net.sf.farrago.db.FarragoDbSession.prepareImpl(FarragoDbSession.java:769)

at net.sf.farrago.db.FarragoDbSession.prepare(FarragoDbSession.java:720)

at net.sf.farrago.db.FarragoDbStmtContext.prepare(FarragoDbStmtContext.java:154)

at net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.execute(FarragoJdbcEngineStatement.java:104)