使用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. DES 指定键的大小对于此算法无效

    KEY (byte[])  长度不为8.  一般KEY使用UTF8编码.  byte[] byKey = Encoding.UTF8.GetBytes(key); 加密内容的编码,由两方协商. Sys ...

  2. Pyhon时间参数的应用

    Python获取 本周,上周,本月,上月,本季,上季,今年, 去年 # -*- coding: utf-8 -*-# @time: 2019-05-13 17:30 import datetime f ...

  3. RabbitMQ官方教程五 Topic(GOLANG语言实现)

    在上一教程中,我们改进了日志记录系统. 我们没有使用只能进行虚拟广播的fanout交换器,而是使用直接交换器,并有可能选择性地接收日志. 尽管使用直接交换改进了我们的系统,但它仍然存在局限性-它不能基 ...

  4. CF1227D Optimal Subsequences

    思路: 首先对于单个查询(k, p)来说,答案一定是a数组中的前k大数.如果第k大的数字有多个怎么办?取索引最小的若干个.所以我们只需对a数组按照值降序,索引升序排序即可. 多个查询怎么办?离线处理. ...

  5. 阿里云 maven仓库地址配置

    1. maven 配置文件配置settings.xml中设置mirror节点 <mirror> <id>nexus-aliyun</id> <mirrorOf ...

  6. .net字符串内存的分配

    几次面试中遇到都有类似的问题,就是 string str = "aa" + "bb" + "ccc";进行了几次内存分配? 1 class ...

  7. IIS不能下载config配置文件的解决方法

    之前作程序升级的时候,需要从服务端下载后缀为config的配置文件,结果程序抛出404异常.后来百度才知道,是IIS禁止下载config文件的原因.在这里记录一下解决方法. 在我的电脑,右键管理,打开 ...

  8. fastjson<1.2.47 RCE 漏洞复现

    这两天爆出了 fastjson 的老洞,复现简单记录一下. 首先使用 spark 搭建一个简易的利用 fastjson 解析 json 的 http server. package cn.hackte ...

  9. Python TypeError: __init__() got multiple values for argument 'master'(转)

    转自:https://stackoverflow.com/questions/33153404/python-typeerror-init-got-multiple-values-for-argume ...

  10. MacBook Pro 安装composer及Yii2.0

    最近想看看Yii的一些东西,需要安装一下composer curl -sS https://getcomposer.org/installer | php 此操作会下载最新版本到当前的目录下 然后将下 ...