Reply
New Contributor
Posts: 1
Registered: ‎02-04-2019

concat not working in beeline

${beeline_url} --silent=true --showHeader=false --outputformat=csv2 --showWarnings=false -e "select concat('invalidate metadata ', trim(table_name) , '; refresh ', trim(table_name) ,';') from my_Table " > /home/table_list.csv

I'm trying to run this query ends up with error. The same query runs fine in hive, hue and even with beeline.

 

while using beeline, the below query gave results 

 

0: jdbc:hive2://host> select concat("invalidate metadata ", trim(table_name)) from my_Table; 

 

I tried storing the query in a file but it ends up in error. 

 

${beeline_url} --silent=true --showHeader=false --outputformat=csv2 --verbose=false --showWarnings=false -f get_table_list.hql > /home/table_list.csv

 

where get_table_list.hql  has 

 

SELECT (CONCAT('invalidate metadata ', trim(table_name) , '; refresh ', trim(table_name) ,';')) from my_table;

 

Error:

Error: Error while compiling statement: FAILED: ParseException line 1:59 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in select expression (state=42000,code=40000)

Expert Contributor
Posts: 136
Registered: ‎07-17-2017

Re: concat not working in beeline

Hi @zeni86cit

try to change the file content by this

SELECT CONCAT('invalidate metadata ', trim(table_name), '; refresh ', trim(table_name) ,';') from my_table;

or

SELECT CONCAT("invalidate metadata ", trim(table_name), "; refresh ", trim(table_name) ,";") from my_table;

Good luck.