Details
-
Improvement
-
Resolution: Fixed
-
Major
-
4.0.0, 4.1.2, 4.5.1, 4.6.5, 5.0.1, 5.1.1, 5.5.0, 6.0.0, 6.5.0
Description
Consider
SELECT (SELECT date, ARRAY_AGG(DISTINCT expiry) AS expiries
|
FROM `default`
|
WHERE _dataType='o2'
|
AND underlyingId IN [500046, 527383]
|
AND date BETWEEN firstTradeDate AND expiry
|
AND expiry IS NOT MISSING
|
GROUP BY date) FROM ['2018-01-01', '2018-01-02'] date
|
(just a query that returns all trades active on specific expiry dates, grouped by expiry dates).
This is perfectly legal N1QL, which however fails with
Error evaluating projection. - cause: FROM in correlated subquery must have USE KEYS clause: FROM default
|
It's not exactly clear why the limitation is there, but if I remove the check from planner/build_select_from.go:builder.VisitKeyspaceTerm() the request goes through happily and returns the expected results.
I suspect this is a relic from old style joins. It would be good if we could remove this at least for ANSI joins.
Attachments
Issue Links
For Gerrit Dashboard: MB-30813 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
143453,2 | MB-30813 Allow correlated subquery without USE KEYS | master | query | Status: MERGED | +2 | +1 |
143560,2 | MB-30813 Allow correlation variables to be used as index spans | master | query | Status: MERGED | +2 | +1 |
179432,2 | MB-53565 Do not use join predicates as index span if under hash join | master | query | Status: MERGED | +2 | +1 |
183112,2 | MB-54045 Do not use join predicates as index span if under hash join | neo | query | Status: MERGED | +2 | +1 |