8000 DuckDB internal error with a relatively complex JOIN involving lateral subqueries · Issue #16524 · duckdb/duckdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DuckDB internal error with a relatively complex JOIN involving lateral subqueries #16524

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

Closed
2 tasks done
onderkalaci opened this issue Mar 5, 2025 · 0 comments · Fixed by #16537
Closed
2 tasks done

Comments

@onderkalaci
Copy link
Contributor
onderkalaci commented Mar 5, 2025

What happens?

DuckDB throws INTERNAL Error with a relatively complex JOIN involving lateral subqueries

To Reproduce

CREATE TABLE INT8_TBL(q1 int8, q2 int8);

INSERT INTO INT8_TBL VALUES
  ('  123   ','  456'),
  ('123   ','4567890123456789'),
  ('4567890123456789','123'),
  (+4567890123456789,'4567890123456789'),
  ('+4567890123456789','-4567890123456789');


select * from
  int8_tbl c left join (
    int8_tbl a left join (select q1, coalesce(q2,42) as x from int8_tbl b) ss1
      on a.q2 = ss1.q1
    cross join
    lateral (select q1, coalesce(ss1.x,q2) as y from int8_tbl d) ss2
  ) on c.q2 = ss2.q1,
  lateral (select ss2.y offset 0) ss3;
ERROR:  Unknown Error

INTERNAL Error: Failed to bind column reference "x" [3.1] (bindings: {#[9.0], #[9.1]})
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/dev/internal_errors

Removing the last lateral subquery avoids the crash:

select * from
  int8_tbl c left join (
    int8_tbl a left join (select q1, coalesce(q2,42) as x from int8_tbl b) ss1
      on a.q2 = ss1.q1
    cross join
    lateral (select q1, coalesce(ss1.x,q2) as y from int8_tbl d) ss2
  ) on c.q2 = ss2.q1

OS:

MacOS

DuckDB Version:

1.1.3 and 1.2.0

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Onder KALACI

Affiliation:

Crunchy Data

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@hannes hannes changed the title DuckDB crashes with a relatively complex JOIN involving lateral subqueries DuckDB internal error with a relatively complex JOIN involving lateral subqueries Mar 5, 2025
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 15, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 15, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 16, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 17, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 18, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
krlmlr added a commit to duckdb/duckdb-r that referenced this issue May 18, 2025
Fix duckdb/duckdb#16524: DEPENDENT_JOIN may not flatten (duckdb/duckdb#16537)
CrossVersion.yml: Add v1.2.1, v1.2-histrionicus and main (duckdb/duckdb#16576)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0