hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aihua Xu (JIRA)" <>
Subject [jira] [Updated] (HIVE-15231) query on view with CTE and alias fails with table not found error
Date Thu, 17 Nov 2016 21:19:58 GMT


Aihua Xu updated HIVE-15231:
    Status: Patch Available  (was: Open)

Initial patch: seems we are using table alias to check if the table is CTE or not, but the
aliasToCTE is holding the mapping of CTE_Name=>CTE like subtb => CTE, so for table with
alias like {{subtb a}} we should use tableName to check if it's CTE.

> query on view with CTE and alias fails with table not found error
> -----------------------------------------------------------------
>                 Key: HIVE-15231
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Planning
>    Affects Versions: 1.3.0
>            Reporter: Aihua Xu
>            Assignee: Aihua Xu
>         Attachments: HIVE-15231.1.patch
> HIVE-10698 fixed one issue of the query on view with CTE, but it seems to break another
case if a alias is given for the CTE.
> {noformat}
> use bugtest;
> create table basetb(id int, name string);
> create view testv1 as
> with subtb as (select id, name from bugtest.basetb)
> select id from subtb a;
> use castest;
> explain select * from bugtest.testv1;
> hive> explain select * from bugtest.testv1;
> FAILED: SemanticException Line 2:21 Table not found 'subtb' in definition of VIEW testv1
> with subtb as (select `basetb`.`id`, `basetb`.`name` from `bugtest`.`basetb`)
> select `a`.`id` from `bugtest`.`subtb` `a`
> ] used as testv1 at Line 1:14
> {noformat}

This message was sent by Atlassian JIRA

View raw message