dynamobi/dynamobi — Issue #814: [FRG-56] type mismatch error calling numeric functions on decimals with scale
Author: dynamobi-build
Created: 2011-12-30 03:50:12+00:00
State: open
Labels: FRG, Statement Processing

[reporter="schoi", created="Thu, 23 Feb 2006 18:18:03 -0500 (GMT-05:00)"]
similar error to FRG-55

Calling numeric functions (floor, ceil) on a decimal type with some S causes type mismatch assertion error.

repro:

---------

create table d (d decimal primary key, d2 decimal(2,1), d3 decimal);

select ceil(d3) from d;

+---------+

| EXPR$0 |

+---------+

+---------+

select ceil(d2) from d;

output:

------------

Error: java.lang.AssertionError: Type mismatch:

rel rowtype:

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

equivRel rowtype:

RecordType(DECIMAL(2, 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(2, 0) EXPR$0) NOT NULL

equivRel rowtype:

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

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

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

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

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

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

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

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

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