标签:io ar sp for 数据 on bs ad ef
一句话,Hive 开发比 Pig快多了...
从hdfs读取数据:
Hive: CREATE EXTRENAL TABLE IF NOT EXIST (domain string, num int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘ location ‘hdfs_file‘;
Pig: LOAD ‘hdfs_file‘ USING PigStorage (‘\t‘) as (domain:chararray, num:int);
存储:
Hive: INSERT OVERWRITE DIRECTORY ‘target_hdfs_file‘ SELECT... ;
Pig: STORE result into ‘target_hdfs_file‘;
同SQL的比较:
Hive没有in和not in,"select a.key where a.key in {select b.key from b}"的实现方式为"select a.key from a left outer join b on a.key=b.key where b.key is not null;"
Pig就更麻烦了...
区别:
Pig存储默认分隔符‘\t‘, Hive为‘Ctrl+A‘
标签:io ar sp for 数据 on bs ad ef
原文地址:http://www.cnblogs.com/cs-jack-cheng/p/4110336.html