Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Regarding the text file compression

avatar
New Contributor

Is it possible to compress a 'TEXTFILE' in hive/impala, without converting to other formats (like parquet and orc)?

Thanks

2 REPLIES 2

avatar
@Krishna R

In your Hive terminal, set the following properties

set hive.exec.compress.output=true;
set mapreduce.output.fileoutputformat.compress.codec=org.apache.hadoop.io.compress.GzipCodec;

This will enable the compression and will set the compression codec, gzip in this case.

Now you can insert the data into an HDFS directory and the output will be in gzip format.

insert overwrite directory 'myHDFSDirectory' row format delimited fields terminated by ',' select * from myTable;

This will store the output of my select * query in the HDFS directory.

Let know if that works for you.

avatar
@Krishna R

Did the answer help in the resolution of your query? Please close the thread by marking the answer as Accepted!