LucidDB / luciddb

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

[FRG-49] avg set function is not working #821

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[reporter="schoi", created="Sun, 19 Feb 2006 22:39:40 -0500 (GMT-05:00)"] Not sure from error msg if avg() is just not implemented yet..

repro sql:
---------------
create schema s;
set schema 's';

create table t1 (i int primary key);
insert into t1 values(1);

select avg(i) from t1;

error:
---------
Error: java.lang.AssertionError: Internal error: node could not be implemented: Subset#3.ITERATOR (state=,code=0)
net.sf.farrago.util.FarragoUtil$FarragoSqlException: java.lang.AssertionError: Internal error: node could not be implemented: Subset#3.ITERATOR
        at org.eigenbase.util.Util.newInternal(Util.java:820)
        at com.disruptivetech.farrago.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:318)
        at org.eigenbase.rel.RelVisitor.go(RelVisitor.java:75)
        at com.disruptivetech.farrago.volcano.RelSubset.buildCheapestPlan(RelSubset.java:231)
        at com.disruptivetech.farrago.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:435)
        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="jvs", created="Sun, 19 Feb 2006 22:59:27 -0500 (GMT-05:00)"] The error message is the generic optimizer assertion for "Help! I can't find an implementation for the given query." Reason being in this case that we haven't yet supplied a rule to turn AVG into SUM/COUNT. So yes, not yet implemented past validation, but will be soon.

dynamobi-build commented 12 years ago

[author="jvs", created="Wed, 19 Apr 2006 11:49:05 -0500 (GMT-05:00)"] Need an optimizer rule to rewrite this.

dynamobi-build commented 12 years ago

[author="jvs", created="Mon, 24 Apr 2006 22:43:25 -0500 (GMT-05:00)"] Implemented in eigenchange 6363.