Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to store a binary file (image feched from url) into a hive table

how to store a binary file (image feched from url) into a hive table

Explorer

Hi all,

I fetch some images from the web.

I created a hive table this way:

 

CREATE TABLE images(id INT, url STRING, picture BINARY)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS SEQUENCEFILE
LOCATION 'mypath/images'

 

I thought to create a file and put it into the hdfs location ('mypath/images') but I really don't know what to write into that file about the binary image column...

the same, I dont' kknow how to INSERT directly into the hive table

 

someone can help me?

thanks

2 REPLIES 2

Re: how to store a binare file (image teched from url) into a hive table

Master Guru
Is Hive a good choice for the analysis you're attempting to perform on this
dataset? Wouldn't something more expressive such as Spark be more useful?

You cannot insert binaries as part of a simple statement. You'll need to
create a writer that converts the raw forms into sequence files and then
use LOAD DATA to place those files into the table.

Re: how to store a binare file (image teched from url) into a hive table

Explorer

Hi HArsh and thank you for your suggestion

 

Have you some sample or example?

Could I use python for that?

Don't have an account?
Coming from Hortonworks? Activate your account here