[
https://issues.apache.org/jira/browse/LENS-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14247800#comment-14247800
]
Sushil Mohanty commented on LENS-126:
-------------------------------------
The above query fails due to alias is missing in the referred column in order
by. replaceAlias expects column to be prefixed with "alias." for eg.
alias.column. To handle such cases where alias is not specified. we need to
replace the column as it is in the tree.
> jdbc rewrite error while using alias name in order by
> -----------------------------------------------------
>
> Key: LENS-126
> URL: https://issues.apache.org/jira/browse/LENS-126
> Project: Apache Lens
> Issue Type: Bug
> Reporter: Raghavendra Singh
> Assignee: Sushil Mohanty
> Fix For: 2.0
>
>
> for a query having:
> select col1 as alias1 . . . order by alias1 desc limit 10
> the rewritten query misses the alias name and is rewritten as:-
> order by desc limit 10
> error message:-
> {CODE}
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near 'desc limit 10'
> at line 1
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:3206)
> at com.mysql.jdbc.Statement.execute(Statement.java:727)
> at
> com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:1006)
> at
> org.apache.lens.driver.jdbc.JDBCDriver$QueryCallable.call(JDBCDriver.java:299)
> at
> org.apache.lens.driver.jdbc.JDBCDriver.executeInternal(JDBCDriver.java:694)
> at org.apache.lens.driver.jdbc.JDBCDriver.explain(JDBCDriver.java:573)
> ... 5 more
> {CODE}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)