简体   繁体   中英

How to “insert into values” using Hive,Pig or MapReduce?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM