Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.5.0
Description
When an in/exists-subquery appears inside an aggregate expression within a top-level GROUP BY, it gets rewritten and a new `exists` variable is introduced. However, this variable is incorrectly handled in aggregation. For example, consider the following query:
```
SELECT
CASE
WHEN t1.id IN (SELECT id FROM t2) THEN 10
ELSE -10
END AS v1
FROM t1
GROUP BY t1.id;
```
Executing it leads to the following error:
```
java.lang.IllegalArgumentException: Cannot find column index for attribute 'exists#844' in: Map()
```