hive - Impala 子查询返回奇怪的结果
问题描述
我正在运行下面的 impala 查询,我得到了奇怪的结果。为什么下面的第二个查询返回零结果以及如何克服这个问题。我正在用多个表做几个数据管道,所以我必须在开始时使用“with”。
1. Query: select * from test where name <> 'INSERT'
+----+--------+
| id | name |
+----+--------+
| 2 | DELETE |
| 2 | HELLO |
+----+--------+
Fetched 2 row(s) in 0.13s
2. Query: with temp as (select * from test where name <> 'INSERT') select * from temp
Modified 0 row(s) in 0.23s
3. Query: with temp as (select * from test where name <> 'HELLO') select * from temp
+----+--------+
| id | name |
+----+--------+
| 2 | DELETE |
| 1 | INSERT |
+----+--------+
Fetched 2 row(s) in 0.12s
It should give the record names with 'HELLO' and 'DELETE' for the 2nd query. but its giving no results. Also noticed the output says "modified", so i am guessing its trying to execute it as DML.
Note : Using Impala Shell v2.11.0-cdh5.14.2
The same query works fine in hive.
解决方案
它似乎对我有用
with temp as (SELECT *
FROM
(SELECT 'DELETE' AS name
UNION SELECT 'HELLO' AS name
UNION SELECT 'INSERT' AS name) AS subq
WHERE name <> 'INSERT')
select * from temp;
+---------+
| name |
+---------+
| HELLO |
| DELETE |
+---------+
2 rows selected (0.118 seconds)
你能发布EXPLAIN PLAN
你的第二个查询吗?
推荐阅读
- c# - Blazor EditForm 提交两次而不是一次
- c# - 发生索引超出范围异常
- reactjs - reactjs 正确使用函数和钩子 - 我收到错误
- mysql - 检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 'identified by 'wordpress#demo'' 附近使用正确的语法
- javascript - TypeError:_this.props.loginState 不是函数
- python - 根据分箱输入计算百分位数
- android - 如何使用集合更新 Firebase Firestore 文档中的字段
- python - 查找属于列但不属于高阶列的对数
- internationalization - 如何将 pg_search_scope 与 Mobility 一起使用来翻译属性?
- python - 使用 Sprite 组时图像未在 Pygame 上显示