使用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. 【2B设计】途牛商旅全案设计

    整体设计方案: 途牛商旅全案设计 https://www.uisdc.com/tuniu-business-travel

  2. CSS3 Filter特效

    CSS3 filter和IE的filter完全是两样东东. Filters主要是运用在图片上,以实现一些特效.(尽管他们也能运用于video上),不过我们在些只来讨论图片上的运用. 语法 elm { ...

  3. 解决jQuery版本冲突

    解决jquery版本冲突问题 <!-- 引入1.6.4版的jq --><script src="http://ajax.googleapis.com/ajax/libs/j ...

  4. tomcat 启动闪退解决方法

    当我们在windows上面进行项目的部署与启动的时候有的时候tomcat在进行启动的时候会删一下就退了,这个时候一般是里面启动的时候设置的jdk的问题下面咱们来看一下具体解决方案 编辑我们的start ...

  5. unix 命令

    ubuntu  命令窗口的打开 打开命令行窗口: Ctrl+Alt+T 在打开的命令行窗口中打开一个新的Tab: Ctrl+Shift+T 在同一窗口的Tab间切换: Ctrl+Page Up 或者 ...

  6. 手把手带你入门神秘的RxJava

    1.什么是RxJava• Rx是Reactive Extensions的简写,翻译为响应的扩展.也就是通过由一方发出信息,另一方响应信息并作出处理的核心框架代码. • 该框架由微软的架构师Erik M ...

  7. 探索typescript的必经之路-----接口(interface)

    TypeScript定义接口 熟悉编程语言的同学都知道,接口(interface)的重要性不言而喻. 很多内容都会运用到接口.typescrip中的接口类似于java,同时还增加了更灵活的接口类型,包 ...

  8. 【转帖】K8S Deployment 命令

    K8S Deployment 命令 https://www.cnblogs.com/Tempted/p/7831604.html 今天学习了一下 kubectl scale deployment xx ...

  9. [EF] - "已有打开的与此 Command 相关联的 DataReader,必须首先将它关闭" 之解决

    错误 解决 在 ConnectionString 中添加 MultipleActiveResultSets=true(适用于SQL 2005以后的版本).MultipleActiveResultSet ...

  10. Eclipse控制台不限日志行数

    在使用Eclipse时,如果控制台输出的内容比较多,控制台之前的内容就会消失,导致前面的控制台打印信息无法查看. 设置Eclipse的控制台属性 设置方法: 打开Eclipse的菜单栏:Window ...