Skip to content

Unexpected internal error in multi-join query #17700

@TheoristCoder

Description

@TheoristCoder

What happens?

Dear DuckDB developers,
I meet a new crash error again, please see the below cases. If you can review it, I will appreciate.

CREATE TABLE t0(c0 BOOLEAN);
CREATE TABLE t2(c1 INT);
CREATE TABLE t3(c0 INT);

INSERT INTO t3(c0) VALUES (1);
INSERT INTO t0(c0) VALUES (TRUE);
CREATE VIEW v0(c0, c1, c2) AS SELECT DISTINCT t0.c0 AS col_0, t0.c0 AS col_1, t3.c0 AS col_2 FROM t0, t3;
INSERT INTO t2(c1) VALUES (1);


SELECT * FROM t2, v0 INNER JOIN ( SELECT t2.c1 AS col_0 WHERE v0.c2) as subQuery0 ON v0.c2;

INTERNAL Error:
ExpressionExecutor::Execute called with a result vector of type BOOLEAN that does not match expression type INTEGER

Stack Trace:

0        duckdb::Exception::Exception(duckdb::ExceptionType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 64
1        duckdb::InternalException::InternalException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 20
2        duckdb::InternalException::InternalException<duckdb::LogicalType, duckdb::LogicalType>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, duckdb::LogicalType, duckdb::LogicalType) + 88
3        duckdb::ExpressionExecutor::Execute(duckdb::Expression const&, duckdb::ExpressionState*, duckdb::SelectionVector const*, unsigned long long, duckdb::Vector&) + 884
4        duckdb::ExpressionExecutor::Execute(duckdb::DataChunk*, duckdb::DataChunk&) + 92
5        duckdb::PhysicalHashJoin::Sink(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::OperatorSinkInput&) const + 60
6        duckdb::PhysicalRightDelimJoin::Sink(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::OperatorSinkInput&) const + 104
7        duckdb::PipelineExecutor::ExecutePushInternal(duckdb::DataChunk&, duckdb::ExecutionBudget&, unsigned long long) + 264
8        duckdb::PipelineExecutor::Execute(unsigned long long) + 356
9        duckdb::PipelineTask::ExecuteTask(duckdb::TaskExecutionMode) + 260
10       duckdb::ExecutorTask::Execute(duckdb::TaskExecutionMode) + 288
11       duckdb::Executor::ExecuteTask(bool) + 544
12       duckdb::ClientContext::ExecuteTaskInternal(duckdb::ClientContextLock&, duckdb::BaseQueryResult&, bool) + 64
13       duckdb::PendingQueryResult::ExecuteInternal(duckdb::ClientContextLock&) + 120
14       duckdb::PendingQueryResult::Execute() + 56
15       duckdb_shell_sqlite3_print_duckbox + 520
16       duckdb_shell::ShellState::ExecutePreparedStatement(sqlite3_stmt*) + 528
17       duckdb_shell::ShellState::ExecuteSQL(char const*, char**) + 488
18       duckdb_shell::ShellState::RunOneSqlLine(char*) + 248
19       duckdb_shell::ShellState::ProcessInput() + 1092
20       main + 3960
21       start + 6000

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/stable/dev/internal_errors

To Reproduce

CREATE TABLE t0(c0 BOOLEAN);
CREATE TABLE t2(c1 INT);
CREATE TABLE t3(c0 INT);

INSERT INTO t3(c0) VALUES (1);
INSERT INTO t0(c0) VALUES (TRUE);
CREATE VIEW v0(c0, c1, c2) AS SELECT DISTINCT t0.c0 AS col_0, t0.c0 AS col_1, t3.c0 AS col_2 FROM t0, t3;
INSERT INTO t2(c1) VALUES (1);


SELECT * FROM t2, v0 INNER JOIN ( SELECT t2.c1 AS col_0 WHERE v0.c2) as subQuery0 ON v0.c2;

OS:

MacOS

DuckDB Version:

DuckDB v1.4.0-dev202 (Development Version) 9bbabce

DuckDB Client:

CLI

Hardware:

No response

Full Name:

TheoristCoder

Affiliation:

Personal Project

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

I have tested with a nightly 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions