Hive中条件的重要性顺序是什么?

k10s72fa  于 2021-06-24  发布在  Hive
关注(0)|答案(0)|浏览(198)

我得到的查询结果不同,唯一的区别是where条件的顺序不同。这可能是因为源表出了问题。

SELECT *
FROM source
WHERE ((submission <> 'Y' or submission is NULL) and payment >0.01)
OR (submission='Y' and payment_2 > 0.01);

Result 1:
+----------+-------------+-------------+------------+----------+
|   Name   |    entry    | submission  | payment_2  | payment  |
+------------------------------+-------------+-----------------+
| abc      | 1           | NULL        | 0.0        | 790.5    |
+----------+-------------+-------------+------------+----------+

Query 2:

SELECT *
FROM source
WHERE (submission='Y' and payment_2 > 0.01)
OR ((submission <> 'Y' or submission is NULL) and payment >0.01);

Result 2:
+----------+-------------+-------------+------------+----------+
|   Name   |    entry    | submission  | payment_2  | payment  |
+------------------------------+-------------+-----------------+
+----------+-------------+-------------+------------+----------+```

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题