使用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 table ...)

CREATE EXTERNAL TABLE IF NOT EXISTS test_t1(
  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

建立分区:当设置partitioned by (day_time string)时,表示以day_time来进行分区 --- (alter table ...)

alter table test_t1 add IF NOT EXISTS partition (day_time='');

#或者 (同样可加也可不加:IF NOT EXISTS)
alter table database_name.test_t1 add IF NOT EXISTS partition (day_time='')

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

注意:建数据库和建表时,均有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的更多相关文章

  1. Error: Error while compiling statement: FAILED: SemanticException Unable to determine if hdfs://hadoopNode2:8020/user/hive/warehouse/test is encrypted...

    1.发现问题: 在hive客户端或者beeline查询hive表时候报错: 根据报错信息查看,是在集群namenode做了HA之后,产生的hdfs路径不对的问题: 2.解决问题,修改hive元数据my ...

  2. hive sequencefile导入文件遇到FAILED: SemanticException Unable to load data to destination table. Error: The file that you are trying to load does not match the file format of the destination table.错误

    hive sequencefile导入文件遇到FAILED: SemanticException Unable to load data to destination table. Error: Th ...

  3. Unable to determine if the owner (Domain\UserName) of job JOB_NAME has server access

    早上巡检的的时候,发现一数据库的作业报如下错误(作业名等敏感信息已经替换),该作业的OWNER为一个域账号: JOB RUN: 'JOB_NAME' was run on 2016-6-1 at 7: ...

  4. Unable to determine the device handle for GPU 0000:01:00.0: GPU is lost.问题排坑

    在运行maskrcnn时,会碰到训练不动的问题,就卡在这儿 UserWarning: Converting sparse IndexedSlices to a dense Tensor of unkn ...

  5. Java Spring Boot: Unable to determine jdbc url from datasource

    如果你和我一样从github或码云上下载了一个几年前别人写的demo代码,想用来做学习用.编译的时候遇到下面这样的错误,然后死命上网查各种方案,百试不灵.试尽了各种方案,就是还连接不上数据库.你可以试 ...

  6. hadoop_异常_01_ Unable to determine address of the host-falling back to "localhost" address java.net.UnknownHostException: rayner

    一.异常现象 安装好hadoop之后,执行格式化namenode命令时,抛出以下异常: // :: WARN net.DNS: Unable to determine local hostname - ...

  7. Unable to determine the principal end of an association between the types '***. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.

    MVC中数据库表如果是一对一的主键关系时要加[Required]不然会出错Unable to determine the principal end of an association between ...

  8. mongodb 排序 Unable to determine the serialization information for the expression 异常

    好久没用mongodb了...最近又开始用起来了. 遇到情景:   2句话分开写.是正常的,因为我是先取再排序的   然而.我想直接排序出来. 就写在了一起.最后.ToList()   然后报 Una ...

  9. proftpd启动失败提示unable to determine IP address of “xxx.com”

    proftpd启动失败提示unable to determine IP address of “xxx.com”这种proftpd启动失败的原因是无法解析后面主机的IP地址,解决方法是在DNS列表中增 ...

随机推荐

  1. Python - Django - ORM 自定义表名

    通过 Django 建立的表 命名方式为:项目名_表名 可以将该默认命名方式进行修改 models.py: from django.db import models class Person(mode ...

  2. JAVA操作word方法

    jacob,功能非常强大,能操作word,excel和pdf.下载地址是:http://sourceforge.net/projects/jacob-project/ 1.新建一个文档  Dispat ...

  3. python字符串/列表/元组/字典之间的相互转换(5)

    一.字符串str与列表list 1.字符串转列表 字符串转为列表list,可以使用str.split()方法,split方法是在字符串中对指定字符进行切片,并返回一个列表,示例代码如下: # !usr ...

  4. LeetCode 1022. 从根到叶的二进制数之和(Sum of Root To Leaf Binary Numbers)

    1022. 从根到叶的二进制数之和 1022. Sum of Root To Leaf Binary Numbers 题目描述 Given a binary tree, each node has v ...

  5. 实现不同分辨率、不同浏览器下高度自适应、iframe高度自适应

    html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <tit ...

  6. python基础学习(七)

    14.return # print() 可以被执行 def doubelNumber(num): print() print() Afnum = doubelNumber() print(Afnum) ...

  7. 使用Lombok总结

    Lombok学习总结 Project Lombok is a java library that automatically plugs into your editor and build tool ...

  8. Object 方法的 hashCode,equals方法源码

    文章目录 hashCode方法注释 equals 方法注释 equals 方法 hashCode方法注释 Object 的 hashCode 方法,是本地方法: Returns a hash code ...

  9. 【程序人生】程序员真会玩,工作996,生病ICU

    昨天Github上一个项目彻底爆红了网络,短短一天star数突破一万,Issues已破1800,大家纷纷说出有关企业的不合理加班行为,句句吐露程序员的心声,掀起了一波抵制加班潮,抵制996. 该项目里 ...

  10. C++知识点总结篇

    const在不同位置时的不同意义 指针类型前:声明一个指向常量的指针,程序中不能通过指针来改变它所指向的值,但指针本身的值可以改变,即指针可以指向其他数据: "*"号和指针名之间, ...