FAQ
Hi Adline,
Impala's query parser handles keywords slightly differently than Hive.
Since "count" is a keyword, Impala gets confused when you use it as a
column alias. To work around this, you can either use an alias that is not
a keyword or you can escape the alias name using backticks. For example:

select count(*) AS `count` FROM temp

Impala also accepts single quotes to escape the alias name, but this syntax
doesn't appear to work in Hive. For example:

select count(*) AS 'count' FROM temp

Thanks,
Lenni


On Fri, Oct 25, 2013 at 2:22 AM, Adline wrote:

Whenever I run a query with alias count, it returns error. is this a known
issue? the same seems to work in hive.

[cd-master:21000] > SELECT count(*) AS count FROM temp;
Query: select jantina AS count FROM temp
ERROR: AnalysisException: Syntax error at:
select count(*) AS count FROM temp
^
Encountered: COUNT
Expected: IDENTIFIER

CAUSED BY: Exception: Syntax error


hive> SELECT count(*) AS count FROM temp;
Total MapReduce jobs = 3
Launching Job 1 out of 3
Number of reduce tasks not specified. Estimated from input data size: 37
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
set mapred.reduce.tasks=<number>
Starting Job = job_201310241738_0005, Tracking URL =
http://cd-master:50030/jobdetails.jsp?jobid=job_201310241738_0005
Kill Command =
/opt/cloudera/parcels/CDH-4.4.0-1.cdh4.4.0.p0.39/lib/hadoop/bin/hadoop job
-kill job_201310241738_0005
Hadoop job information for Stage-1: number of mappers: 144; number of
reducers: 37
2013-10-25 17:20:16,579 Stage-1 map = 0%, reduce = 0%
2013-10-25 17:20:44,179 Stage-1 map = 1%, reduce = 0%, Cumulative CPU
51.26 sec

Regards,
Adline

To unsubscribe from this group and stop receiving emails from it, send an
email to impala-user+unsubscribe@cloudera.org.
To unsubscribe from this group and stop receiving emails from it, send an email to impala-user+unsubscribe@cloudera.org.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupimpala-user @
categorieshadoop
postedOct 25, '13 at 3:35p
activeOct 25, '13 at 3:35p
posts1
users1
websitecloudera.com
irc#hadoop

1 user in discussion

Lenni Kuff: 1 post

People

Translate

site design / logo © 2022 Grokbase