1
votes

I am new for hadoop and big data concepts. I am using Hortonworks sandbox and trying to manipulate values of a csv file. So I imported the file using file browser and created a table in hive to do some query. Actually I want to have an "insert into values" query to select some rows, change the value of columns(for example change string to binary 0 or 1) and insert it into a new table. SQL LIKE query could be something like this:

Insert into table1 (id, name, '01')
select id, name, graduated
from table2
where university = 'aaa'

Unfortunately hive could not insert (constant) values (without importing from file) and I don`t know how to solve this problem using hive,pig or even mapreduce scripts. Please help me to fine the solution,I really need to it. Thanks in advance.

1
Please give the structure of table1 and table2 first. - Mukesh S
CREATE TABLE table1(userid STRING, name STRING, graduated STRING) and CREATE TABLE table2(userid STRING, name STRING, graduated BINARY) In fact, I want to convert some values to Binary and insert them into new table. - user3836445

1 Answers

1
votes

In Hive,

 CREATE TABLE table1 as SELECT id, name, graduated FROM table2
    WHERE university = 'aaa'

should create a new table with the results of the query.