dynamobi/dynamobi — Issue #772: [FRG-98] order by [desc|asc] fails at the same location
Author: dynamobi-build
Created: 2011-12-30 03:48:18+00:00
State: open
Labels: FRG, SQL Validator

[reporter="wael", created="Wed, 22 Mar 2006 13:15:10 -0500 (GMT-05:00)"]
order by [desc|asc] fails at the same location.

If you dont have time to fix this one but have to time to explain how to fix it I can probably do it.

=========================================================================

0: jdbc:farrago:> select empno+1 from sales.emps order by empno desc;

Error: java.lang.UnsupportedOperationException: class

net.sf.saffron.sql.SqlCall: `EMPNO` DESC (state=,code=0)

java.sql.SQLException: java.lang.UnsupportedOperationException: class

net.sf.saffron.sql.SqlCall: `EMPNO` DESC

at openjava.mop.Toolbox.needToImplement(Toolbox.java:1154)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertOrder(SqlToRelConverter.java:895)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:199)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:907)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertValidatedQuery(SqlToRelConverter.java:181)

at net.sf.saffron.oj.stmt.OJStatement.prepareSql(OJStatement.java:395)

at

net.sf.farrago.query.FarragoPreparingStmt.implement(FarragoPreparingStmt.java:279)

at

net.sf.farrago.db.FarragoDatabase$1.initializeEntry(FarragoDatabase.java:533)

at

net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:144)

at

net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:541)

at

net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:473)

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)

=========================================================================

0: jdbc:farrago:> select empno+1 from sales.emps order by empno;

Error: java.lang.AssertionError: null (state=,code=0)

java.sql.SQLException: java.lang.AssertionError: null

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertOrder(SqlToRelConverter.java:891)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:199)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:907)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertValidatedQuery(SqlToRelConverter.java:181)

at net.sf.saffron.oj.stmt.OJStatement.prepareSql(OJStatement.java:395)

at

net.sf.farrago.query.FarragoPreparingStmt.implement(FarragoPreparingStmt.java:279)

at

net.sf.farrago.db.FarragoDatabase$1.initializeEntry(FarragoDatabase.java:533)

at

net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:144)

at

net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:541)

at

net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:473)

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)

=========================================================================

0: jdbc:farrago:> select empno+1 from sales.emps order by empno asc;

Error: java.lang.AssertionError: null (state=,code=0)

java.sql.SQLException: java.lang.AssertionError: null

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertOrder(SqlToRelConverter.java:891)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:199)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:907)

at

net.sf.saffron.sql2rel.SqlToRelConverter.convertValidatedQuery(SqlToRelConverter.java:181)

at net.sf.saffron.oj.stmt.OJStatement.prepareSql(OJStatement.java:395)

at

net.sf.farrago.query.FarragoPreparingStmt.implement(FarragoPreparingStmt.java:279)

at

net.sf.farrago.db.FarragoDatabase$1.initializeEntry(FarragoDatabase.java:533)

at

net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:144)

at

net.sf.farrago.db.FarragoDatabase.prepareStmtImpl(FarragoDatabase.java:541)

at

net.sf.farrago.db.FarragoDatabase.prepareStmt(FarragoDatabase.java:473)

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 #2 From John Sichi 2004-06-04 13:28 [reply] -------

ORDER BY is implemented. However, two sub-features are not yet implemented:

(1) DESC

(2) ORDER BY . In this case, empno is considered an expression since it's not in the select list. The code should really be using a needToImplement rather than an assert.

I'm reopening but changing to a P5 enhancement request. Wael, in this case you can use ORDER BY 1 (ordinal notation) to get it to order by the right expression. I'm glad the SQL tests are all getting ORDER BY clauses.

------- Comment #5 From Wael Chatila 2004-06-17 15:25 [reply] -------

having some kind of ORDER BY is necessary when testing queries that return multiple rows since rows can technically be returned in a different order for each run.

------- Comment #6 From John Sichi 2004-06-18 22:19 [reply] -------

Note that the SQL standard does not support ORDER BY . For standards compliance, you have to compute the expression in the select list, and then order by that select item (even if you don't really want that data returned). Most vendors supply an extension for this