Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 09-29-2013 10:54 AM - edited 09-16-2022 01:48 AM
Starting Impala Shell in unsecure mode
Connected to node05.kyc.megafon.ru:21000
Server version: impalad version 1.1.1 RELEASE (build 83d5868f005966883a918a819a449f636a5b3d5f)
Welcome to the Impala shell. Press TAB twice to see a list of available commands.
Copyright (c) 2012 Cloudera, Inc. All rights reserved.
(Shell build version: Impala Shell v1.1.1 (83d5868) built on Fri Aug 23 17:28:05 PDT 2013)
It works:
select cnt, msisdn from(
select count(*) as cnt, msisdn
from ZZZ_ROUTES_MSK
group by msisdn
) t
where cnt > 50 and cnt < 100
order by cnt desc limit 10;
It doesn't work:
select count(*) as cnt, msisdn
from ZZZ_ROUTES_MSK
where cnt > 50 and cnt < 100
group by msisdn
order by cnt desc limit 10;
Query: select count(*) as cnt, msisdn
from ZZZ_ROUTES_MSK
group by msisdn
where cnt > 50 and cnt < 100
order by cnt desc limit 10
[localhost:21000] > select count(*) as cnt, msisdn
> from ZZZ_ROUTES_MSK
>
> where cnt > 50 and cnt < 100
>
> group by msisdn
> order by cnt desc limit 10;
Query: select count(*) as cnt, msisdn
from ZZZ_ROUTES_MSK
where cnt > 50 and cnt < 100
group by msisdn
order by cnt desc limit 10
ERROR: AnalysisException: couldn't resolve column reference: 'cnt'
Why?
Created 09-29-2013 09:24 PM
Why? Because COUNT(*) is an aggregate and to filter on a aggregate you would use a HAVING clause, or use an in-line view as you have done.
Created 09-29-2013 09:24 PM
Why? Because COUNT(*) is an aggregate and to filter on a aggregate you would use a HAVING clause, or use an in-line view as you have done.
Created on 09-29-2013 10:04 PM - edited 10-07-2013 12:57 AM
Thank you!