Support Questions

Find answers, ask questions, and share your expertise

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

avatar
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

avatar
Mentor
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.

avatar
Explorer

Hi HArsh and thank you for your suggestion

 

Have you some sample or example?

Could I use python for that?