[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

Aggregations fail on VIEW which is defined on a TABLE and another VIEW: SQLParseException[Couldn't create execution plan] #17051

Closed
amotl opened this issue Nov 23, 2024 · 1 comment · Fixed by #17083
Assignees
Labels
bug Clear identification of incorrect behaviour tool: dbt dbt labs

Comments

@amotl
Copy link
Member
amotl commented Nov 23, 2024

CrateDB version

CrateDB Nightly

CrateDB setup information

Docker standard.

Problem description

When exercising a specific test case of dbt-postgres against CrateDB, while working on dbt-cratedb2, we discovered a set of statements that fails on the aggregation query on top of a view that is defined on top of a table and another view.

Steps to Reproduce

create table t01 as (select 1 as id);
create view  v02 as (select 2 as id);

create view v03 as (
  select * from t01
  union all
  select * from v02
);

select * from v03;
select count(*) from v03;

Actual Result

SQLParseException[Couldn't create execution plan from logical plan because of: Index 0 out of bounds for length 0:
HashAggregate[count(*)] (rows=1)
  └ Rename[] AS doc.v03 (rows=unknown)
    └ Union[] (rows=unknown)
      ├ Collect[doc.t01 | [] | true] (rows=unknown)
      └ Rename[id] AS doc.v02 (rows=unknown)
        └ Eval[2 AS id] (rows=unknown)
          └ TableFunction[empty_row | [] | true] (rows=unknown)]

Expected Result

+----------+
| count(*) |
+----------+
|        2 |
+----------+
@amotl amotl added triage An issue that needs to be triaged by a maintainer tool: dbt dbt labs labels Nov 23, 2024
@BaurzhanSakhariev BaurzhanSakhariev self-assigned this Nov 25, 2024
@BaurzhanSakhariev BaurzhanSakhariev added bug Clear identification of incorrect behaviour and removed triage An issue that needs to be triaged by a maintainer labels Nov 25, 2024
@mergify mergify bot closed this as completed in #17083 Nov 29, 2024
@BaurzhanSakhariev
Copy link
Contributor

Hi @amotl, thanks for the report!

Fix will be available in the next 5.9.5 hotfix release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Clear identification of incorrect behaviour tool: dbt dbt labs
Projects
None yet
2 participants