Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8.0, 10.5, 10.6, 10.11, 11.4, 11.8
-
git rev-parse HEAD
11a6c1b30a12c448ddfe05e1b818a6a228e90e43
Description
Description: The behavior of the INTERVAL function is inconsistent when used in a SELECT query. The first query, which uses the INTERVAL function and selects columns, returns correct results. However, when the same INTERVAL function is used in the WHERE clause to filter the results, the query returns an empty set. These results should be consistent, but they are not.
Steps to Reproduce:
DROP TABLE IF EXISTS `t0`;
|
|
CREATE TABLE `t0` (
|
`c1` double, |
`c2` double |
);
|
INSERT INTO `t0` VALUES (23,-16); |
query1:
select distinct
|
subq_0.c_0 as c_0,
|
subq_0.c_1 as c_1,
|
subq_0.c_2 as c_2,
|
INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2) as c_7,
|
(INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2)
|
> 0) as w_1 |
from
|
(select distinct
|
ref_0.c1 as c_0,
|
ref_0.c2 as c_1,
|
(ref_0.c2) / (ref_0.c1) as c_2
|
from
|
t0 as ref_0
|
) as subq_0
|
where (INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2))
|
output:
+------+------+---------------------+-----+-----+
|
| c_0 | c_1 | c_2 | c_7 | w_1 |
|
+------+------+---------------------+-----+-----+
|
| 23 | -16 | -0.6956521739130435 | 2 | 1 | |
+------+------+---------------------+-----+-----+
|
1 row in set (0.00 sec) |
query2:
select distinct
|
subq_0.c_0 as c_0,
|
subq_0.c_1 as c_1,
|
subq_0.c_2 as c_2,
|
INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2) as c_7,
|
(INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2)
|
> 0) as w_1 |
from
|
(select distinct
|
ref_0.c1 as c_0,
|
ref_0.c2 as c_1,
|
(ref_0.c2) / (ref_0.c1) as c_2
|
from
|
t0 as ref_0
|
) as subq_0
|
where (INTERVAL(subq_0.c_0,
|
subq_0.c_1,
|
subq_0.c_2)>0) |
output:
Empty set (0.00 sec) |
Expected Behavior:
Both queries should return the same result
Actual Behavior:
but the second query returns an empty set, while the first query returns the expected row.
Attachments
Activity
Transition | Time In Source Status | Execution Times |
---|
|
3d 10h 9m | 1 |