New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't create execution plan from logical plan because of: Index 2 out of bounds for length 2 #14805
Labels
bug
Clear identification of incorrect behaviour
Comments
Thanks again for reporting @YuanchengJiang . Similar to #14807, this could be workaround by providing column aliases: -- create a mini summits table
cr> create table summits as (select * from sys.summits limit 10);
CREATE OK, 10 rows affected (1.702 sec)
-- reproducible:
cr> SELECT DISTINCT count (distinct T1.country), count (distinct T2.mountain), count (distinct T3.country) FROM summits as T1 INNER JOIN summits a
s T2 ON T1.country>T2.country CROSS JOIN summits as T3 UNION SELECT DISTINCT count (distinct T1.country), count (distinct T2.mountain), count
(distinct T3.country) FROM summits as T1 CROSS JOIN summits as T2 JOIN summits as T3 ON T2.mountain>T3.mountain;
SQLParseException[Couldn't create execution plan from logical plan because of: Index 2 out of bounds for length 2:
GroupHashAggregate["collection_count(collect_set(country))", "collection_count(collect_set(mountain))", "collection_count(collect_set(country))"] (rows=2)
└ Union["collection_count(collect_set(country))", "collection_count(collect_set(mountain))"] (rows=2)
├ GroupHashAggregate[collection_count(collect_set(country)), collection_count(collect_set(mountain)), collection_count(collect_set(country))] (rows=1)
│ └ HashAggregate[collect_set(country), collect_set(mountain), collect_set(country)] (rows=1)
│ └ NestedLoopJoin[CROSS] (rows=unknown)
│ ├ NestedLoopJoin[INNER | (country > country)] (rows=unknown)
│ │ ├ Rename[country] AS t1 (rows=unknown)
│ │ │ └ Collect[doc.summits | [country] | true] (rows=unknown)
│ │ └ Rename[mountain, country] AS t2 (rows=unknown)
│ │ └ Collect[doc.summits | [mountain, country] | true] (rows=unknown)
│ └ Rename[country] AS t3 (rows=unknown)
│ └ Collect[doc.summits | [country] | true] (rows=unknown)
└ GroupHashAggregate[collection_count(collect_set(country)), collection_count(collect_set(mountain)), collection_count(collect_set(country))] (rows=1)
└ HashAggregate[collect_set(country), collect_set(mountain), collect_set(country)] (rows=1)
└ NestedLoopJoin[CROSS] (rows=unknown)
├ NestedLoopJoin[INNER | (mountain > mountain)] (rows=unknown)
│ ├ Rename[mountain] AS t2 (rows=unknown)
│ │ └ Collect[doc.summits | [mountain] | true] (rows=unknown)
│ └ Rename[country, mountain] AS t3 (rows=unknown)
│ └ Collect[doc.summits | [country, mountain] | true] (rows=unknown)
└ Rename[country] AS t1 (rows=unknown)
└ Collect[doc.summits | [country] | true] (rows=unknown)]
-- column aliases prevent the exception:
cr> SELECT DISTINCT count (distinct T1.country) x, count (distinct T2.mountain) y, count (distinct T3.country) z FROM summits as T1 INNER JOIN sum
mits as T2 ON T1.country>T2.country CROSS JOIN summits as T3 UNION SELECT DISTINCT count (distinct T1.country), count (distinct T2.mountain),
count (distinct T3.country) FROM summits as T1 CROSS JOIN summits as T2 JOIN summits as T3 ON T2.mountain>T3.mountain;
+---+---+---+
| x | y | z |
+---+---+---+
| 2 | 9 | 3 |
| 3 | 9 | 3 |
+---+---+---+
SELECT 2 rows in set (0.045 sec) |
jeeminso
added
bug
Clear identification of incorrect behaviour
and removed
triage
An issue that needs to be triaged by a maintainer
labels
Oct 8, 2023
5 tasks
@YuanchengJiang |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CrateDB version
5.4.3
CrateDB setup information
Use the system dataset: sys.summits
Problem description
Out of bound:
Steps to Reproduce
Run:
Actual Result
Expected Result
The valid query should return results.
The text was updated successfully, but these errors were encountered: