天天看點

Presto:Unable to create input format com.hadoop.mapred.DeprecatedLzoTextInputFormat錯誤解析

我的hive中的ods層表是這樣存儲的:

drop table if exists ods_ipqc_online_tmp;
create external table ods_ipqc_online_tmp
(
    `MACH_ID`       string COMMENT '機台id',
    `MACH_IP`       decimal(16, 2) COMMENT '機台ip',
    `IPQC_ONLINEID` string COMMENT 'IPQC線上ID',
    `CREATE_TIME`   string COMMENT '建立時間',
    `PROD_SN`       string COMMENT '産品sn',
    `DOT_ID`        string COMMENT '點位id',
    `DOT_VALUE`     string COMMENT '檢測值',
    `dt`            string COMMENT '時間分區'
) COMMENT 'ipqc臨時表'
    row format delimited fields terminated by '\t' -- 指定分割符為\t
    STORED AS -- 指定存儲方式,讀資料采用LzoTextInputFormat;輸出資料采用TextOutputFormat
        INPUTFORMAT 'com.hadoop.mapred.DeprecatedLzoTextInputFormat'
        OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
    location '/warehouse/cut/ods/ods_ipqc_online_tmp/' -- 指定資料在hdfs上的存儲位置
;
           

使用presto連接配接查詢會報錯:

Query failed (#20210605_060112_00015_smuct) in hadoop-presto: Unable to create input format com.hadoop.mapred.DeprecatedLzoTextInputFormat

不能直接讀取ods的lzo,但是如果你把hadoop-3.1.3/share/hadoop/common/hadoop-lzo-0.4.20.jar複制到presto/plugin/hive-hadoop2裡,其他層的 parquet + lzo 是支援查詢的。

建表語句如:

drop table if exists dwd_dim_coupon_info;
create external table dwd_dim_coupon_info(
    `id` string COMMENT '購物券編号',
    `coupon_name` string COMMENT '購物券名稱',
    `coupon_type` string COMMENT '購物券類型 1 現金券 2 折扣券 3 滿減券 4 滿件打折券',
    `condition_amount` decimal(16,2) COMMENT '滿額數',
    `condition_num` bigint COMMENT '滿件數',
    `activity_id` string COMMENT '活動編号',
    `benefit_amount` decimal(16,2) COMMENT '減金額',
    `benefit_discount` decimal(16,2) COMMENT '折扣',
    `create_time` string COMMENT '建立時間',
    `range_type` string COMMENT '範圍類型 1、商品 2、品類 3、品牌',
    `spu_id` string COMMENT '商品id',
    `tm_id` string COMMENT '品牌id',
    `category3_id` string COMMENT '品類id',
    `limit_num` bigint COMMENT '最多領用次數',
    `operate_time`  string COMMENT '修改時間',
    `expire_time`  string COMMENT '過期時間'
) COMMENT '優惠券次元表'
PARTITIONED BY (`dt` string)
stored as parquet
location '/warehouse/gmall/dwd/dwd_dim_coupon_info/'
tblproperties ("parquet.compression"="lzo");
           

解決方案:

建立一張 parquet + lzo 表,将lzo表中資料抽取到新表,即可查詢

繼續閱讀