Skip to content

Multiple Join Crash with Vector::Reference used on vector of different type #17335

@TheoristCoder

Description

@TheoristCoder

What happens?

Hi, DuckDB Developers,
Please see the below cases. I perform a multiple join but it crashes.

CREATE TABLE t1(c0 BOOLEAN);
CREATE TABLE t2(c0 DOUBLE);


INSERT INTO t1(c0) VALUES (true);
INSERT INTO t2(c0) VALUES (0.2);

SELECT * FROM t2, (SELECT 0) RIGHT JOIN ( SELECT 0 AS col_0, t2.c0 AS col_2) as subQuery1 ON ((subQuery1.col_0)>(subQuery1.col_2)) RIGHT JOIN t1 ON true;
INTERNAL Error:
Vector::Reference used on vector of different type

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::Vector::Reference(duckdb::Vector const&) + 100
3        duckdb::ExpressionExecutor::Execute(duckdb::Expression const&, duckdb::ExpressionState*, duckdb::SelectionVector const*, unsigned long long, duckdb::Vector&) + 356
4        duckdb::ExpressionExecutor::Execute(duckdb::DataChunk*, duckdb::DataChunk&) + 92
5        duckdb::PhysicalHashJoin::ExecuteInternal(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::DataChunk&, duckdb::GlobalOperatorState&, duckdb::OperatorState&) const + 376
6        duckdb::CachingPhysicalOperator::Execute(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::DataChunk&, duckdb::GlobalOperatorState&, duckdb::OperatorState&) const + 52
7        duckdb::PipelineExecutor::Execute(duckdb::DataChunk&, duckdb::DataChunk&, unsigned long long) + 480
8        duckdb::PipelineExecutor::ExecutePushInternal(duckdb::DataChunk&, duckdb::ExecutionBudget&, unsigned long long) + 108
9        duckdb::PipelineExecutor::TryFlushCachingOperators(duckdb::ExecutionBudget&) + 460
10       duckdb::PipelineExecutor::Execute(unsigned long long) + 508
11       duckdb::PipelineTask::ExecuteTask(duckdb::TaskExecutionMode) + 328
12       duckdb::ExecutorTask::Execute(duckdb::TaskExecutionMode) + 288
13       duckdb::TaskScheduler::ExecuteForever(std::__1::atomic<bool>*) + 628
14       void* std::__1::__thread_proxy[abi:ne180100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(duckdb::TaskScheduler*, std::__1::atomic<bool>*), duckdb::TaskScheduler*, std::__1::atomic<bool>*>>(void*) + 56
15       _pthread_start + 136
16       thread_start + 8

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 t1(c0 BOOLEAN);
CREATE TABLE t2(c0 DOUBLE);


INSERT INTO t1(c0) VALUES (true);
INSERT INTO t2(c0) VALUES (0.2);

SELECT * FROM t2, (SELECT 0) RIGHT JOIN ( SELECT 0 AS col_0, t2.c0 AS col_2) as subQuery1 ON ((subQuery1.col_0)>(subQuery1.col_2)) RIGHT JOIN t1 ON true;

OS:

MacOS

DuckDB Version:

v1.3.0-dev2944 60efcc9

DuckDB Client:

CLI

Hardware:

No response

Full Name:

TheoristCoder

Affiliation:

NUS

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