dynamobi/dynamobi — Issue #545: [FRG-327] AssertionError while translating IN list that contains null
Author: dynamobi-build
Created: 2011-12-30 03:34:40+00:00
State: open
Labels: FRG, Sql2Rel

[reporter="jhyde", created="Thu, 10 Jul 2008 11:15:25 -0500 (GMT-05:00)"]
While translating

values(cast(null as integer) in (0, null, 2))

get:

java.lang.RuntimeException: net.sf.farrago.jdbc.FarragoJdbcUtil$FarragoSqlException: java.lang.AssertionError: null

at org.eigenbase.sql2rel.SqlToRelConverter$Blackboard.register(SqlToRelConverter.java:3433)

at org.eigenbase.sql2rel.SqlToRelConverter.substituteSubquery(SqlToRelConverter.java:1021)

at org.eigenbase.sql2rel.SqlToRelConverter.replaceSubqueries(SqlToRelConverter.java:854)

at org.eigenbase.sql2rel.SqlToRelConverter.convertValues(SqlToRelConverter.java:3182)

at org.eigenbase.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:1736)

at org.eigenbase.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:1635)

at org.eigenbase.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:478)

at org.eigenbase.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:453)

at org.eigenbase.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2499)

at org.eigenbase.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:404)

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

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

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

at net.sf.farrago.util.FarragoObjectCache.tryPin(FarragoObjectCache.java:187)

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

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

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

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

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

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

at net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.executeQuery(FarragoJdbcEngineStatement.java:169)

...

Similar statement

values(cast(null as integer) in (0, cast(null as integer), 2))

succeeds.

When fixed, please add test cases to SqlOperatorTests.testInOperator():

checkBoolean("values(cast(null as integer) in (0, null, 2))", null);

and a similar test case to testNotInOperator.