【问题标题】:Using presto to query from Hive external table: Invalid UTF-8 start byte使用 presto 从 Hive 外部表查询:无效的 UTF-8 起始字节
【发布时间】:2018-05-26 21:23:30
【问题描述】:

我刚刚安装了presto,当我使用presto-cli查询hive数据时,出现以下错误:

~$ presto --catalog hive --schema default
presto:default> select count(*) from test3;

Query 20171213_035723_00007_3ktan, FAILED, 1 node
Splits: 131 total, 14 done (10.69%)
0:18 [1.04M rows, 448MB] [59.5K rows/s, 25.5MB/s]

Query 20171213_035723_00007_3ktan failed: com.facebook.presto.hive.$internal.org.codehaus.jackson.JsonParseException: Invalid UTF-8 start byte 0xa5
 at [Source: java.io.ByteArrayInputStream@6eb5bdfd; line: 1, column: 376]

只有当我使用计数、求和等聚合函数时才会发生错误。 但是当我在 Hive CLI 上使用相同的查询时,它可以工作(但需要很长时间,因为它将查询转换为 map-reduce 作业)。

$ hive
WARNING: Use "yarn jar" to launch YARN applications.

Logging initialized using configuration in file:/etc/hive/2.4.2.0-258/0/hive-log4j.properties
hive> select count(*) from test3;
...
MapReduce Total cumulative CPU time: 17 minutes 56 seconds 600 msec
Ended Job = job_1511341039258_0024
MapReduce Jobs Launched:
Stage-Stage-1: Map: 87  Reduce: 1   Cumulative CPU: 1076.6 sec   HDFS Read: 23364693216 HDFS Write: 9 SUCCESS
Total MapReduce CPU Time Spent: 17 minutes 56 seconds 600 msec
OK
51751422
Time taken: 269.143 seconds, Fetched: 1 row(s)

关键是相同的查询在 Hive 上有效,但在 Presto 上无效,我不知道为什么。我怀疑这是因为在 Hive 和 Presto 上使用的 2 json 库不同,但我不太确定。 我使用查询在 Hive 上创建了外部表:

hive> create external table test2 (app string, contactRefId string, createdAt struct <`date`: string, timezone: string, timezone_type: bigint>, eventName string, eventTime bigint, shopId bigint) ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' STORED AS TEXTFILE LOCATION '/data/data-new/2017/11/29/';

谁能帮我解决这个问题?

【问题讨论】:

标签: hive hdfs presto


【解决方案1】:

在这里发布以方便参考:

来自where OP documented a solution

我通过使用此 serde 成功解决了问题:https://github.com/electrum/hive-serde(添加到 /usr/lib/presto/plugin/hive-hadoop2/ 的 presto 和 /usr/lib/hive-hcatalog/share/ 的 hive 集群hcatalog/)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-29
    • 2019-02-18
    相关资源
    最近更新 更多