栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

hive读取索引文件的问题

hive读取索引文件的问题

存在这么一张表,源数据是用LZO压缩并创建了索引

drop table if exists ods_customer;
create external table ods_customer(
    customer_id string,
    customer_name string,
    gender string,
    mobile string,
    birth date
)
partitioned by (dt string)
stored as
    INPUTFORMAT 'com.hadoop.mapred.DeprecaatedLzoTextInputFormat'
    OUTPUTFORMAT  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
location  '/warehouse/library/ods/ods_customer';


-- 加载数据
load data inpath '/origin_data/library/data/ods_customer/2021-09-23' into table ods_customer partition(dt='2021-09-23');


-- 创建索引
hadoop jar /opt/module/hadoop-3.1.3/share/hadoop/common/hadoop-lzo-0.4.20.jar com.hadoop.compression.lzo.DistributedLzoIndexer /warehouse/library/ods/ods_customer/dt=2021-09-23;

那么以下两种查询方式得到的数据量可能是不同的

select * from ods_customer;

select count(*) from ods_customer;

原因是select * from ods_customer不执行MR操作,直接采用的是customer建表语句中指定的DeprecatedLzoTextInputFormat,能够识别lzo.index为索引文件。

select count(*) from ods_customer执行MR操作,会先经过hive.input.format,其默认值为CombineHiveInputFormat,其会先将索引文件当成小文件合并,将其当做普通文件处理。更严重的是,这会导致LZO文件无法切片。

解决方法:修改默认值

hive>set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/303146.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号