Support Questions

Find answers, ask questions, and share your expertise

Not yet supported place for UDAF 'count' on Tutorial Exercise 2

avatar
New Contributor

 on the Tutorial Exercise 2 the next query not works when the line "order by count(*);" is included

(on Hive Editor and cloudera-quickstart-vm-5.5.0-0-vmware)

 

select count(*), url from tokenized_access_logs
where url like '%\/product\/%'
group by url
order by count(*);

 

the error showed is:

Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 4:9 Not yet supported place for UDAF 'count'

 

4 REPLIES 4

avatar

Hi,

 

Thank you for reporting this. You are right, the query fails with that error message, the correct query should be like:

 

select count(*) as cnt, url from tokenized_access_logs
where url like '%\/product\/%'
group by url
order by cnt desc;

 

I will file this to be corrected in the tutorial.

 

Thanks again and cheers,

Miklos

 

Miklos Szurap

Customer Operations Engineer, Cloudera

 

avatar
Guru

That part of the tutorial has you use the Impala query editor - the query should work in Impala's particular flavor of the query language.

avatar
New Contributor

I think the perfect query will use replace function to remove '%' in the url

 

select count(*) as cnt,regexp_replace(url,'%','') as urlt
from tokenized_access_logs
where url like '%\/product\/%'
group by url
order by cnt desc;

 

 

avatar
New Contributor
Just adding replace function to remove '%' from the URL:
select count(*) as cnt,regexp_replace(url,'%','') as urlt
from tokenized_access_logs
where url like '%\/product\/%'
group by url
order by cnt desc;