gpt4 book ai didi

MongoDB hadoop 连接器无法查询 mongo hive 表

转载 作者:可可西里 更新时间:2023-11-01 17:00:36 25 4
gpt4 key购买 nike

我正在使用 MongoDB hadoop 连接器在 hadoop 中使用 hive 表查询 mongoDB。

我可以执行

select * from mongoDBTestHiveTable;

但是当我尝试执行以下查询时

select id from mongoDBTestHiveTable;

它抛出以下异常。

hive lib 文件夹中存在以下类。

异常堆栈跟踪:

    Diagnostic Messages for this Task:
Error: java.io.IOException: Cannot create an instance of InputSplit class = com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit:Class com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit not found
at org.apache.hadoop.hive.ql.io.HiveInputFormat$HiveInputSplit.readFields(HiveInputFormat.java:147)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:71)
at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:42)
at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:370)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:402)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157)
Caused by: java.lang.ClassNotFoundException: Class com.mongodb.hadoop.hive.input.HiveMongoInputFormat$MongoHiveInputSplit not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626)
at org.apache.hadoop.hive.ql.io.HiveInputFormat$HiveInputSplit.readFields(HiveInputFormat.java:144)
... 10 more

Container killed by the ApplicationMaster.

请指教。

最佳答案

您还需要将 mongo-hadoop-* 以及 mongo 驱动程序 jar 添加到所有 worker 上的 MR1/MR2 类路径

关于MongoDB hadoop 连接器无法查询 mongo hive 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24506108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com