LucidDB / luciddb

DEFUNCT: See README
https://github.com/LucidDB/luciddb
Apache License 2.0
53 stars 24 forks source link

[FRG-52] agg(numeric) fails if numeric type is nullable #818

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[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)

dynamobi-build commented 12 years ago

[author="jpham", created="Thu, 27 Apr 2006 18:03:02 -0500 (GMT-05:00)"] This issue involves particlar functions rather than aggregates:

select sum(n/10) from t;
+----------------+
| EXPR$0 |
+----------------+
| 0.10000000000 |
+----------------+

dynamobi-build commented 12 years ago

[author="jpham", created="Sat, 29 Apr 2006 12:36:57 -0500 (GMT-05:00)"] fixed in lu 6456