Hive的严格模式
在hive里面可以通过严格模式防止用户执行那些可能产生意想不到的不好的效果的查询,从而保护hive的集群。
用户可以通过 set hive.mapred.mode=strict 来设置严格模式,改成unstrict则为飞严格模式。 在严格模式下,用户在运行如下query的时候会报错。
1. 分区表的查询没有使用分区字段来限制。
select * from mart_catering.dim_shopca_reduction_ss limit 1000;
得到的错误是
CliDriver update main thread name to 4105daa5-e5a7-49d6-8e02-52c9184732f9
16/08/29 11:20:54 INFO CliDriver: CliDriver update main thread name to 4105daa5-e5a7-49d6-8e02-52c9184732f9 Logging initialized using configuration in jar:file:/opt/meituan/versions/mthive-0.13-package/lib/hive-common-0.13.1.jar!/hive-log4j.properties
FAILED: SemanticException [Error 10041]: No partition predicate found for Alias 'dim_shopca_reduction_ss' Table 'dim_shopca_reduction_ss'
query fails
2. 使用了笛卡尔积
当用户写代码将表的别名写错的时候会引起笛卡尔积,例如
SELECT *
FROM origindb.promotion__campaign c
JOIN origindb.promotion__campaignex ce
ON c.id = c.id
limit 1000
得到的错误信息
CliDriver update main thread name to 9a962abc-afea-470f-9738-dceda72ff1fd
16/08/29 11:38:23 INFO CliDriver: CliDriver update main thread name to 9a962abc-afea-470f-9738-dceda72ff1fd Logging initialized using configuration in jar:file:/opt/meituan/versions/mthive-0.13-package/lib/hive-common-0.13.1.jar!/hive-log4j.properties
FAILED: SemanticException [Error 10052]: In strict mode, cartesian product is not allowed. If you really want to perform the operation, set hive.mapred.mode=nonstrict
query fails
3. order by 的时候没有使用limit
SELECT *
FROM origindb.promotion__campaign
order by id
得到的错误信息
CliDriver update main thread name to 5efafee6-1ce8-4985-9b98-c8f5ff88bccd
16/08/29 11:40:45 INFO CliDriver: CliDriver update main thread name to 5efafee6-1ce8-4985-9b98-c8f5ff88bccd Logging initialized using configuration in jar:file:/opt/meituan/versions/mthive-0.13-package/lib/hive-common-0.13.1.jar!/hive-log4j.properties
FAILED: SemanticException 3:9 In strict mode, if ORDER BY is specified, LIMIT must also be specified. Error encountered near token 'id'
query fails
当使用的limit的时候错误消除。
Hive的严格模式的更多相关文章
- hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式
hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式 命令介绍 命令hadoop fs –safemode get 查看安全模式状态 命令hadoop fs –safemo ...
- hive 非等值连接, 设置hive为nonstrict模式
1 数据准备 create table stocks(id int, date string,price string, company string); insert into table stoc ...
- 大数据学习(11)—— Hive元数据服务模式搭建
这一篇介绍Hive的安装及操作.版本是Hive3.1.2. 调整部署节点 在Hadoop篇里,我用了5台虚拟机来搭建集群,但是我的电脑只有8G内存,虚拟机启动之后卡到没法操作,把自己坑惨了. Hive ...
- Hive 打开调试模式
编程过程中发现错误,无法看到具体的错误信息,网上搜了下,按照下面的方法启动Hive Shell就可以打开调试(注意:此方法只对本次回话有效): hive --hiveconf hive.root.lo ...
- hive集群模式安装
hadoop3.2.0 完全分布式安装 hive-3.1.1 #解压缩tar -zxvf /usr/local/soft/apache-hive-3.1.1-bin.tar.gz -C /usr/lo ...
- hive的strict模式;where,group by,having,order by同时使用的执行顺序
主要限制三种情况 (1) 有partition的表查询需要加上where子句,筛选部分数据实现分区裁剪,即不允许全表全分区扫描,防止数据过大 (2) order by 执行时只产生一个reduce,必 ...
- hive的非交互模式
在linux的终端运行:$HIVE_HOME/bin/hive 会进入交互模式: $HIVE_HOME/bin/hive -e或者-f 是非交互模式 1.非交互模式运行HQL语句 $HIVE_HOM ...
- Hive基础(2)---(启动HiveServer2)Hive严格模式
启动方式 1, hive 命令行模式,直接输入/hive/bin/hive的执行程序,或者输入 hive –service cli 用于linux平台命令行查询,查询语句基本跟mysql查询语句类似 ...
- 【大数据系列】Hive安装及web模式管理
一.什么是Hive Hive是建立在Hadoop基础常的数据仓库基础架构,,它提供了一系列的工具,可以用了进行数据提取转化加载(ETL),这是一种可以存储.查询和分析存储在Hadoop中的按规模数据的 ...
随机推荐
- 例子Architecting Android…The clean way?----代码分析
Presention层: 整个应用启动的时候,就执行依赖的初始化.编译项目之后,Dagger依赖框架使用ApplicationComponent生成一个DaggerApplicationCOmpo ...
- android抽屉导航的设计准则
我阅读了google官方的关于抽屉导航的设计准则,这可以给我带来什么帮助?最起码,我可以知道,抽屉导航适用在什么场景中,使用它时要注意什么事项.App的设计是有规则可以依据的,比如,使用抽屉导航时,是 ...
- HDU 1070 Milk (模拟)
题目链接 Problem Description Ignatius drinks milk everyday, now he is in the supermarket and he wants to ...
- 多github帐号的SSH key切换
我有两个github帐号,一个是个人所用,一个是为公司项目所用.如果是单用户(single-user),很方便,默认拿id_rsa与你的github服务器的公钥对比:如果是多用户(multi-user ...
- Android控件——TextView,EditText
TextView: 显示文本控件 EditText 输入文本框 1.TextView常用属性:
- Java多线程学习(二)synchronized关键字(2)
转载请备注地址:https://blog.csdn.net/qq_34337272/article/details/79670775 系列文章传送门: Java多线程学习(一)Java多线程入门 Ja ...
- node启动服务
npm install http-server -g http-server ipconfig查看当前ip 手机可访问第一个网址.
- Linux网络编程之套接字基础
1.套接字的基本结构 struct sockaddr 这个结构用来存储套接字地址. 数据定义: struct sockaddr { unsigned short sa_family; /* addre ...
- TCP之connect
1. connect函数: #include <sys/socket.h> int connect(int sockfd, const struct sockaddr *servaddr, ...
- pam会话函数详解
pam会话函数详解 http://www.xuebuyuan.com/2223069.html http://blog.itpub.net/15480802/viewspace-1406088/ ht ...