You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Maryann Xue (JIRA)" <ji...@apache.org> on 2016/01/11 20:43:40 UTC

[jira] [Updated] (PHOENIX-2579) Subquery with alias does not work

     [ https://issues.apache.org/jira/browse/PHOENIX-2579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maryann Xue updated PHOENIX-2579:
---------------------------------
    Attachment: PHOENIX-2579.patch

I see, [~ziyangz]. It would be quite a big effort to provide a complete fix for this problem (plus it would be blocked by PHOENIX-2041), given that Phoenix does derived table expansion on the AST level (we will have logical algebra level optimization with Calcite-Phoenix). I'm attaching a patch that hopefully can work for most of your cases.

> Subquery with alias does not work
> ---------------------------------
>
>                 Key: PHOENIX-2579
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2579
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.4.0, 4.6.0, 4.5.2
>            Reporter: Ziyang Zhao
>            Assignee: Maryann Xue
>         Attachments: PHOENIX-2579.patch
>
>
> Used a table without schema and without catalog
> table name: TESTTABLE
> num (DECIMAL(12, 2))
> 100.25
> 200.25
> 300.25
> 400.25
> Did a query:
> select A.num from (select * from testtable) A;
> And got the following error messages:
> Error: error while executing SQL "select A.col3 from (select * from T3CODEBASE_TABLE) A": response code 500 (state=,code=0)
> java.sql.SQLException: error while executing SQL "select A.col3 from (select * from T3CODEBASE_TABLE) A": response code 500
>         at org.apache.calcite.avatica.Helper.createException(Helper.java:39)
>         at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:111)
>         at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:120)
>         at sqlline.Commands.execute(Commands.java:822)
>         at sqlline.Commands.sql(Commands.java:732)
>         at sqlline.SqlLine.dispatch(SqlLine.java:808)
>         at sqlline.SqlLine.begin(SqlLine.java:681)
>         at sqlline.SqlLine.start(SqlLine.java:398)
>         at sqlline.SqlLine.main(SqlLine.java:292)
> Caused by: java.lang.RuntimeException: response code 500
>         at org.apache.calcite.avatica.remote.RemoteService.apply(RemoteService.java:45)
>         at org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:195)
>         at org.apache.calcite.avatica.remote.RemoteMeta.prepareAndExecute(RemoteMeta.java:157)
>         at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:474)
>         at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:108)
>         ... 7 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)