hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan LeCompte <lecom...@gmail.com>
Subject Hive query questions: referring to aliased column in group by and comments
Date Fri, 23 Oct 2009 15:12:15 GMT
Hey guys!

Two questions:


1) Is it possible to refer to an aliased column in the GROUP BY of a single
query? Hive is complaining if I try to do something like:

SELECT if(col1='x',1,0) AS MYALIAS, count(1)
   GROUP BY MYALIAS;

It seems like I have to re-paste the whole if(...) in the GROUP BY for the
query to work. If I have fairly complicated expressions in the SELECT, it's
a bit tedious to copy/paste them again in the GROUP BY. Am I missing
something here?

2) Also, if I have a large query in a myquery.q file to feed into the hive
cli via the -f option, can I specify comments before query so that the hive
engine ignores them? Syntax?

Thanks!

Ryan

Mime
View raw message