drorhun
drorhun

Reputation: 584

Load Data into Hive on EMR

I created a cluster under the EMR service then I connected with Putty. In the meantime, I chose 'presto' when building the cluster.

How do I transfer a file from S3 or on my local computer into the hive?

For example, I need to upload the student file but when I run the following code, I naturally get an error. Where do I put the student file?

hive > load data local inpath 'student' into table student_nopart;

I'm trying to make an example here. https://github.com/weltond/LearnBasicBigDataTech

Upvotes: 1

Views: 3500

Answers (2)

leftjoin
leftjoin

Reputation: 38335

If you already have data in S3, you can build Hive table on top of the S3 location or alter existing Hive table.

ALTER TABLE student SET location='s3://bucket/path/to/folder_with_table_files';

Upvotes: 1

Lamanus
Lamanus

Reputation: 13581

In your code,

load data local inpath ...

the local is meaning the EMR node, not your computer. By using sftp or something, you should upload the file into EMR first and load it.

OR use this.

load data inpath 's3://bucket/path/to/file/' into table <tablename>

Upvotes: 1

Related Questions