You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Vick Fisher (JIRA)" <ji...@apache.org> on 2010/09/30 22:50:36 UTC

[jira] Commented: (HIVE-1449) Table aliases in order by clause lead to semantic analysis failure

    [ https://issues.apache.org/jira/browse/HIVE-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916648#action_12916648 ] 

Vick Fisher commented on HIVE-1449:
-----------------------------------

This is more serious than it first appears.  If you join two tables, and they both have a column with the same name, then there is no way to specify the order by clause in a query that also has group by.  Even with no alias of the table name, just preceding the column name with the table name causes an error.

For example:

SELECT threaded_flight.flight_id, min(threaded_track.altitude) 
FROM threaded_flight JOIN threaded_track ON (threaded_flight.flight_id = threaded_track.flight_id)  
GROUP BY  threaded_flight.flight_id   
ORDER BY  threaded_flight.flight_id

gives the error:

"Error in semantic analysis: line 1:219 Invalid Table Alias or Column Reference threaded_flight"

The query works without the ORDER BY.  

> Table aliases in order by clause lead to semantic analysis failure
> ------------------------------------------------------------------
>
>                 Key: HIVE-1449
>                 URL: https://issues.apache.org/jira/browse/HIVE-1449
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: Ashish Thusoo
>            Assignee: Ashish Thusoo
>             Fix For: 0.7.0
>
>
> A simple statement of the form
> select a.account_id, count(1) from tmp_ash_test2 a group by a.account_id order by a.account_id;
> throws a sematic analysis exception
> where as
> select a.account_id, count(1) from tmp_ash_test2 a group by a.account_id order by account_id;
> works fine (the second query does not have the table alias a in the order by clause.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.