message:For direct MetaStore DB connections, we don't support retries at the client level.)

本文介绍了解决Hive在创建表时遇到的元数据连接错误及字符集问题的方法。首先通过更改MySQL数据库中Hive数据库的字符集为latin1,然后再尝试创建表。若问题仍未解决,建议更换mysql-connector-java版本至5.1.1.38,实测在apache-hive-1.2.0-bin环境下有效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

百度查是字符问题,已解决

1.在创建table时报:“FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Meta Exception(message:For direct MetaStore DB connections, we don't support retries at the client level.)”

或者“FAILED: SemanticException Unable to fetch table flux. For direct MetaStore DB connections, we don't support retries at the client level.”

解决办法:

在mysql数据库中执行:ALTER DATABASE hive CHARACTER SET latin1; 

然后在hive继续创建表成功

2.如果上述办法无效,请替换hive中的mysql-connector-java-×××××-bin.jar

替换为:

mysql-connector-java-5.1.1.38-bin.jar

亲测hive版本:apache-hive-1.2.0-bin替换后好使.

scala> import org.apache.spark.sql.SaveMode import org.apache.spark.sql.SaveMode scala> scala> val data_new = spark.sqlContext.read.table("ad_traffic.case_data_sample").drop("mac").drop("creativeid").drop("mobile_os").drop("mobile_type").drop("app_key_md5").drop("app_name_md5").drop("os_type") data_new: org.apache.spark.sql.DataFrame = [rank: int, dt: int ... 13 more fields] scala> scala> data_new.write.mode(SaveMode.Overwrite).saveAsTable("ad_traffic.case_data_sample_new") 25/06/19 16:56:18 INFO SQLStdHiveAccessController: Created SQLStdHiveAccessController for session context : HiveAuthzSessionContext [sessionString=89a732c1-8cbd-46c2-b098-a685b1902353, clientType=HIVECLI] 25/06/19 16:56:18 WARN SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory. 25/06/19 16:56:18 INFO metastore: Mestastore configuration hive.metastore.filter.hook changed from org.apache.hadoop.hive.metastore.DefaultMetaStoreFilterHookImpl to org.apache.hadoop.hive.ql.security.authorization.plugin.AuthorizationMetaStoreFilterHook 25/06/19 16:56:18 INFO metastore: Closed a connection to metastore, current connections: 0 25/06/19 16:56:18 INFO metastore: Trying to connect to metastore with URI thrift://master1:9083 25/06/19 16:56:18 INFO metastore: Opened a connection to metastore, current connections: 1 25/06/19 16:56:18 INFO metastore: Connected to metastore. 25/06/19 16:56:18 INFO metastore: Trying to connect to metastore with URI thrift://master1:9083 25/06/19 16:56:18 INFO metastore: Opened a connection to metastore, current connections: 2 25/06/19 16:56:18 INFO metastore: Connected to metastore. scala> select * from ad_traffic.case_data_sample_new limit 3; <console>:1: error: ';' expected but '.' found. select * from ad_traffic.case_data_sample_new limit 3
最新发布
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

任错错

如果对您有帮助我很开心

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值