HIVE建表语句中有时会指定inputformat和outputformat,有时又没有。
其实即使我们建表时没有指定,在下一层系统也会给我们指定默认的inputformat和outputformat。
那这两个究竟是什么呢?
drop table if exists ods_log;
CREATE EXTERNAL TABLE ods_log (line
string)
PARTITIONED BY (dt
string) – 按照时间创建分区
STORED AS – 指定存储方式,读数据采用LzoTextInputFormat;
INPUTFORMAT ‘com.hadoop.mapred.DeprecatedLzoTextInputFormat’
OUTPUTFORMAT ‘org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat’
LOCATION ‘/warehouse/gmall/ods/ods_log’ ;
INPUTFORMAT是在读数据文件的时候,MAP阶段使用的类。
那究竟这两个类在哪一步使用呢?请待下回分解。