[teiid-issues] [JBoss JIRA] (TEIID-2802) HIVE2: got Invalid table alias or column reference when running UNION ALL query on HIVE2

Ivan Chan (JIRA) issues at jboss.org
Fri Jan 17 17:10:32 EST 2014


    [ https://issues.jboss.org/browse/TEIID-2802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936711#comment-12936711 ] 

Ivan Chan commented on TEIID-2802:
----------------------------------

This following SQL works:
SELECT v_0.c_0 FROM (SELECT c_0 FROM (SELECT g_1.name AS c_0 FROM
opportunities_small g_1 UNION ALL SELECT g_0.name AS c_0 FROM opportunities
g_0) X__) v_0 GROUP BY v_0.c_0 ORDER BY c_0

However, the one that Teiid generated doesn't work.  It is "ORDER BY v_0.c_0"  instead of "ORDER BY c_0".

Query that Teiid generated:

SELECT v_0.c_0 FROM (SELECT c_0 FROM (SELECT g_1.name AS c_0 FROM
opportunities_small g_1 UNION ALL SELECT g_0.name AS c_0 FROM opportunities
g_0) X__) v_0 GROUP BY v_0.c_0 ORDER BY v_0.c_0

Original Query:

select "name"
from (Select * from hive2.opportunities_small UNION ALL Select * from
hive2.opportunities) "query"
group by "name"
order by "name"
                
> HIVE2:  got Invalid table alias or column reference when running UNION ALL query on HIVE2
> -----------------------------------------------------------------------------------------
>
>                 Key: TEIID-2802
>                 URL: https://issues.jboss.org/browse/TEIID-2802
>             Project: Teiid
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 8.6
>         Environment: TEIID with HIVE2
>            Reporter: Ivan Chan
>            Assignee: Steven Hawkins
>              Labels: teiid
>
> If I tried to combine 2 tables from a same HIVE2 data source using UNION ALL, I got "Invalid table alias or column reference" error.
> Query that I submitted to Teiid originally:
> select "name"
> from (Select * from hive2.opportunities_small UNION ALL Select * from
> hive2.opportunities) "query"
> group by "name"
> order by "name"
> Query that Teiid generated:
> SELECT v_0.c_0 FROM (SELECT c_0 FROM (SELECT g_1.name AS c_0 FROM
> opportunities_small g_1 UNION ALL SELECT g_0.name AS c_0 FROM opportunities
> g_0) X__) v_0 GROUP BY v_0.c_0 ORDER BY v_0.c_0
> Error:
> Invalid table alias or column reference 'v_0': (possible column names are: c_0)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list