Support Questions
Find answers, ask questions, and share your expertise

concat not working in beeline

concat not working in beeline

New Contributor

${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)

1 REPLY 1

Re: concat not working in beeline

Expert Contributor

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.