首页 > 数据库技术 > 详细

FAILED: SemanticException Unable to determine if hdfs://tmaster:8020/user/root/words.db/test_t2 is encrypted

时间:2019-10-31 17:48:44      阅读:184      评论:0      收藏:0      [点我收藏+]

使用hive时,建立数据库,建表,写数据;

读数据:select *  from test_t2;

报错SemanticException

原因:建表时使用了其他路径,或者在另一个路径的数据库(建立数据库时指定了location参数:create database words_db location ‘hdfs://tmaster:8020/user/root/words.db‘)中建表test_t2,也就是因为在建表时没有在默认路径下建立,默认路径是:/user/hive/warehouse/databasename.db/tablename/partition_name (注意要建立分区)

解决方法:

1. 方法一:重新在默认路径下建表,也就是不显式指定location参数,直接默认即可;

例如:建立外部分区表(指定location参数):

CREATE EXTERNAL TABLE IF NOT EXISTS test_t2(
   column_1 string
  ,column_2 string
  ,column_3 string
 )PARTITIONED BY (day_time string)
 ROW FORMAT DELIMITED FIELDS TERMINATED BY ,
 STORED AS TEXTFILE
 LOCATION /user/root/test;

默认建表(不指定location参数):

create table test_t1(column_1 string,column_2 string) partitioned by (day_time string) row format delimited fields terminated by ‘\1‘;

其中:row format delimited fields terminated by ‘\1‘ 表示行内的列分隔符是‘\1‘。

2. 方法二:修改设置参数location,参考:https://blog.csdn.net/ggwxk1990/article/details/78067803

 

一般的流程:建表--->建立分区--->写数据

注意:建数据库和建表时,均有location参数

 

参考:

https://blog.csdn.net/Thomson617/article/details/86153924

https://blog.csdn.net/qq_36743482/article/details/78383964

 

## 欢迎交流

FAILED: SemanticException Unable to determine if hdfs://tmaster:8020/user/root/words.db/test_t2 is encrypted

原文:https://www.cnblogs.com/qi-yuan-008/p/11772121.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!