Support Questions

Find answers, ask questions, and share your expertise

Saving output of impala query to hdfs

avatar
Contributor

Is it possible to save the output of an impala query to hdfs .

 

Sample query 

 

impala-shell --ssl -i "${load_balancer}" -f  "${2}" -o "${3}"

Would like to have it saved not to local but to hdfs.

 

Thanks

1 ACCEPTED SOLUTION

avatar
Master Collaborator

Hi @gimp077

I think there is two ways to do it:

1- You can put the output of impala-query in HDFS after you get it in a system file with PUT HDFS command:

sudo -u hdfs hdfs dfs -put "${3}" hdfs_path


2- You can use a directe insert into a result_table (stored in HDFS) just before your select statement:

INSERT INTO result_tables YOUR_QUERY

 

View solution in original post

1 REPLY 1

avatar
Master Collaborator

Hi @gimp077

I think there is two ways to do it:

1- You can put the output of impala-query in HDFS after you get it in a system file with PUT HDFS command:

sudo -u hdfs hdfs dfs -put "${3}" hdfs_path


2- You can use a directe insert into a result_table (stored in HDFS) just before your select statement:

INSERT INTO result_tables YOUR_QUERY