Skip to content

Logical error: 'Bad cast from type DB::ColumnVector<int> to DB::ColumnNullable'. #78572

@PedroTadim

Description

@PedroTadim

Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels.

Test name: Logical error: Bad cast from type A to B
CI report: AST fuzzer (amd_ubsan)
CIDB statistics: cidb

Describe the bug

The original error: Logical error: '(isConst() || isSparse()) ? getDataType() == rhs.getDataType() : typeid(*this) == typeid(rhs)'.

It seems not related to #75450
From this run: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=78284&sha=e585d4785d24bf1a150dd74887c45a6405c760a4&name_0=PR&name_1=AST+fuzzer+%28ubsan%29

Seems to be a regression in the current master. Time to bisect 😄

How to reproduce

I managed to reduce it to a simple script:

CREATE TABLE t0 (k1 Nullable(Int)) ENGINE = Memory;
CREATE TABLE t2 (k1 Int) ENGINE = Join(ALL, FULL, k1);
INSERT INTO t0 VALUES (1);
INSERT INTO t2 VALUES (1);
SELECT t1.k1 FROM t0 FULL JOIN t2 t1 USING (k1) FULL JOIN t2 t2 USING (k1);
/*
Logical error: 'Bad cast from type DB::ColumnVector<int> to DB::ColumnNullable'.
*/

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'Bad cast from type DB::ColumnVector<int> to DB::ColumnNullable'.
<Fatal> : Stack trace (when copying this message, always include the lines below):

0. std::exception::exception[abi:ne190107]() @ 0x0000000017abaad4
1. base/poco/Foundation/src/Exception.cpp:27: Poco::Exception::Exception(String const&, int) @ 0x0000000035655800
2. src/Common/Exception.cpp:108: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000023b24c2b
3. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000001796e2f6
4. DB::Exception::Exception<String, String>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String>::type>, String&&, String&&) @ 0x000000001796d0af
5. DB::ColumnNullable const& assert_cast<DB::ColumnNullable const&, DB::IColumn const&>(DB::IColumn const&) @ 0x0000000018bcc87d
6. src/DataTypes/Serializations/SerializationNullable.cpp:67: DB::SerializationNullable::serializeBinaryBulkStatePrefix(DB::IColumn const&, DB::ISerialization::SerializeBinaryBulkSettings&, std::shared_ptr<DB::ISerialization::SerializeBinaryBulkState>&) const @ 0x000000002c3e7f42
7. src/Formats/NativeWriter.cpp:85: DB::NativeWriter::write(DB::Block const&) @ 0x000000003160defa
8. src/Server/TCPHandler.cpp:2485: DB::TCPHandler::sendData(DB::QueryState&, DB::Block const&) @ 0x0000000031520a00
9. src/Server/TCPHandler.cpp:1267: DB::TCPHandler::processOrdinaryQuery(DB::QueryState&) @ 0x000000003150f732
10. src/Server/TCPHandler.cpp:679: DB::TCPHandler::runImpl() @ 0x00000000314fabd9
11. src/Server/TCPHandler.cpp:2630: DB::TCPHandler::run() @ 0x000000003152a20e
12. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000035785682
13. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000035786352
14. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x00000000356ea057
15. base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x00000000356e5a4e
16. ? @ 0x00007ffff7ca1e2e
17. ? @ 0x00007ffff7d33a4c

Metadata

Metadata

Labels

bugConfirmed user-visible misbehaviour in official releasefuzzProblem found by one of the fuzzerstestingSpecial issue with list of bugs found by CI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions