LucidDB / luciddb

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

[FRG-86] EXISTS fails in optimizer #784

Open dynamobi-build opened 12 years ago

dynamobi-build commented 12 years ago

[reporter="jhyde", created="Wed, 22 Mar 2006 12:29:39 -0500 (GMT-05:00)"] EXISTS fails in optimizer.
 
 
0: jdbc:farrago:> select age from sales.emps where exists (select age from
sales.emps);
Error: net.sf.saffron.runtime.SaffronError: Internal error: while visiting
tree (state=,code=0)
java.sql.SQLException: net.sf.saffron.runtime.SaffronError: Internal error:
while visiting tree
        at openjava.mop.Toolbox.newInternal(Toolbox.java:1132)
        at net.sf.saffron.opt.OptUtil.go(OptUtil.java:180)
        at net.sf.saffron.opt.RelSubset.buildCheapestPlan(RelSubset.java:192)
        at
net.sf.saffron.opt.VolcanoPlanner.findBestExp(VolcanoPlanner.java:310)
        at net.sf.saffron.oj.stmt.OJStatement.prepareSql(OJStatement.java:409)
        at
net.sf.farrago.query.FarragoPreparingStmt.implement(FarragoPreparingStmt.java:283)
        at
net.sf.farrago.db.FarragoDatabase$1.initializeEntry(FarragoDatabase.java:546)
        at
net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:144)
        at
net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:554)
        at
net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:486)
        at
net.sf.farrago.db.FarragoDbSession.prepare(FarragoDbSession.java:550)
        at
net.sf.farrago.db.FarragoDbStmtContext.prepare(FarragoDbStmtContext.java:125)
        at
net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.execute(FarragoJdbcEngineStatement.java:106)
        at sqlline.SqlLine$Commands.sql(SqlLine.java:3501)
        at sqlline.SqlLine.dispatch(SqlLine.java:911)
        at sqlline.SqlLine.begin(SqlLine.java:762)
        at sqlline.SqlLine.mainWithInputRedirection(SqlLine.java:436)
        at sqlline.SqlLine.main(SqlLine.java:419)

------- Comment #5 From Julian Hyde 2005-11-08 14:06 [reply] -------
The fix would be in the SQL to Rel translation process. We now have the right relational expression -- CorrelatorRel -- to translate to.

We would also have to make sure that the validation is being done correctly, and update the spec for how EXISTS interacts with streaming queries (is it OK to write 'select * from aTable where exists (select * from aStream)'?)