Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - subquery syntax error


Copy link to this message
-
Re: subquery syntax error
Igor Tatarinov 2012-06-06, 06:22
The columns you ORDER BY must be SELECTed. If you don't want identifier2 in
the output, you will need to wrap your query with another SELECT.

Hope this helps.
igor
decide.com

On Tue, Jun 5, 2012 at 10:53 PM, Avdeev V. M. <[EMAIL PROTECTED]> wrote:

> Hello!
>
> I can't understand what's wrong.
>
>    drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select cast(2 as int) identifier2, short_descr area_name from t0) asdf
> select *--area_name
> order by identifier2 desc, area_name asc
> ;
>
> The query works fine but if I remove * then
>
> drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select cast(2 as int) identifier2, short_descr area_name from t0) asdf
> select area_name
> order by identifier2 desc, area_name asc
> ;
>
> fails with error "FAILED: Error in semantic analysis: Line 6:9 Invalid
> table alias or column reference identifier2"
> The query
>
> drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select short_descr area_name from t0) asdf
> select area_name
> order by area_name asc
> ;
>
> works fine too. What's wrong with 'no mapped' columns?
>
> Thanks!
>