Hive与MySQL的技术差异点:
- 语法
- 存储
- 数据类型
- 排序
- 子查询
- 抽样查询
重点:hive和MySQL查询语句的区别:
- MySQL:子查询支持完整
- Hive:
1、Hive不支持if或case when里的子查询
比如:
select
a.user_id,
case when a.id = (select id from a) then a.id else null end as a.id
from a
2、Hive中主查询的引用仅在子查询的where子句中支持
子查询where子句中引用主查询a.name字段
select *,
(select count(*)-1 from a as b where b.name = a.nam) as num
from a ;
子查询sum子句中引用主查询a.name字段(此处hive不支持)
select *,
(select sum(if(b.name = a.name,1,0)) -1 from a as b ) as num
from a ;
版权声明:本文为qq_41815243原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。