Predictive Hacks

How to export a Hive table to S3

You can export a hive table to S3 in a single file using the following code snippet.

set mapred.reduce.tasks = 1;
insert overwrite directory 's3a://my-bucket/my_filename'
row format delimited fields terminated by ','
select * from mytable order by column_a;
set mapred.reduce.tasks = -1;

Note that we used the order by statement in order to force a single reducer since we didn’t; have any other “reduce” operation like “group by” and so on.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Python

Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.

Python

Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s