hadoop - storing pig output into Hive table in a single instance -
i insert pig output hive tables(tables in hive created exact schema).just need insert output values table. dont want usual method, wherein first store file, read file hive , insert tables. need reduce hop done.
is possible. if please tell me how can done ?
thanks
ok. create external hive table schema layout somewhere in hdfs directory. lets
create external table emp_records(id int, name string, city string) row formatted delimited fields terminated '|' location '/user/cloudera/outputfiles/usecase1';
just create table above , no need load file directory.
now write pig script read data input directory , when store output of pig script use below
a = load 'inputfile.txt' using pigstorage(',') as(id:int,name:chararray,city:chararray); b = filter id > = 678933; c = foreach b generate id,name,city; store c '/user/cloudera/outputfiles/usecase1' using pigstorage('|');
ensure destination location , delimiter , schema layout of final foreach statement in pigscript matches hive ddl schema.
Comments
Post a Comment