Get error "mismatched input 'as' expecting FROM near ')' in from clause" when run sql query Hadoop Java -
i created 2 tables java code tablehivecell
, tablehivewifi
.
when try run followed sql command:
select count(ues.cnc) 'active ues' ^ (select distinct cnc tablehivecell wifi union select distinct cnc tablehivecell cell) ues;
i error:
java.sql.sqlexception: query returned non-zero code: 11, cause: failed: parse error: line 1:22 mismatched input 'as' expecting near ')' in clause @ org.apache.hadoop.hive.jdbc.hivestatement.executequery(hivestatement.java:189).
did miss something?
[edit 1]
i tried:
select count(ues.cnc) 'active ues' ^ (select distinct cnc tablehivecell wifi) union (select distinct cnc tablehivecell cell) ues;
same error
[edit 2]
i tried:
select count(ues.cnc) active_ues (select distinct cnc tablehivecell wifi union select distinct cnc tablehivecell cell) ues; ^
get same error last as
:
line 1:142 mismatched input 'as' expecting identifier near ')' in subquery source
as requested in answer form: hadoop seems have problems aliases via as
keyword on subqueries , can assign alias without as
keyword.
example can found here: https://www.inkling.com/read/hadoop-definitive-guide-tom-white-3rd/chapter-12/querying-data
and quoted future visitors ( see mt
alias subquery ):
select station, year, avg(max_temperature) ( select station, year, max(temperature) max_temperature records2 temperature != 9999 , (quality = 0 or quality = 1 or quality = 4 or quality = 5 or quality = 9) group station, year ) mt group station, year;
Comments
Post a Comment