```
SELECT
    NULL IN 
    (
        SELECT
            9223372036854775807,
            9223372036854775807
    ),
    NULL
FROM 
(
    SELECT DISTINCT
        NULL,
        NULL,
        NULL IN 
        (
            SELECT (NULL, '-1')
        ),
        NULL
    FROM numbers(1024)
)

Query id: 90734124-e0bb-4e6e-8c3c-7eb0faeb180d

[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.848802 [ 43485 ] {90734124-e0bb-4e6e-8c3c-7eb0faeb180d} <Fatal> : Logical error: 'Block structure mismatch in QueryPipeline stream: different number of columns:
in(NULL, _subquery3) Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1))), NULL Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1)))
NULL Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1))), NULL Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1))), in(NULL, _subquery3) Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1))), NULL Nullable(Nothing) Const(size = 0, Nullable(size = 1, Nothing(size = 1), UInt8(size = 1)))'.
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.850460 [ 1089 ] <Fatal> BaseDaemon: ########################################
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.851027 [ 1089 ] <Fatal> BaseDaemon: (version 20.13.1.1, build id: CAFCE24B8B3F01D0E242774F447E758106BCDFE3) (from thread 43485) (query_id: 90734124-e0bb-4e6e-8c3c-7eb0faeb180d) Received signal Aborted (6)
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.851539 [ 1089 ] <Fatal> BaseDaemon: 
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.852007 [ 1089 ] <Fatal> BaseDaemon: Stack trace: 0x7fa9e938e18b 0x7fa9e936d859 0x86e219c 0x86e2241 0x10dfc533 0x10df93c6 0x10df92b5 0x11fef631 0x122740c1 0x122b4a73 0x115af1ef 0x1172ce53 0x1172b89a 0x11f3a4fb 0x11f45a08 0x1679938c 0x16799b90 0x168cdd13 0x168cac3d 0x168c9ac8 0x7fa9e9543609 0x7fa9e946a103
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.857165 [ 1089 ] <Fatal> BaseDaemon: 4. /build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51: raise @ 0x4618b in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.858544 [ 1089 ] <Fatal> BaseDaemon: 5. /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:81: __GI_abort @ 0x25859 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.859379 [ 1089 ] <Fatal> BaseDaemon: 6. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Common/Exception.cpp:50: DB::handle_error_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x86e219c in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.859954 [ 1089 ] <Fatal> BaseDaemon: 7. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Common/Exception.cpp:56: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x86e2241 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.897298 [ 1089 ] <Fatal> BaseDaemon: 8. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Core/Block.cpp:483: void DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::'lambda'(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) const @ 0x10dfc533 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.935117 [ 1089 ] <Fatal> BaseDaemon: 9. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Core/Block.cpp:490: void DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x10df93c6 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:07.972457 [ 1089 ] <Fatal> BaseDaemon: 10. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Core/Block.cpp:538: DB::assertBlocksHaveEqualStructure(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x10df92b5 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.020356 [ 1089 ] <Fatal> BaseDaemon: 11. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Processors/QueryPipeline.cpp:288: DB::QueryPipeline::addPipelineBefore(DB::QueryPipeline) @ 0x11fef631 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.069952 [ 1089 ] <Fatal> BaseDaemon: 12. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Processors/QueryPlan/CreatingSetsStep.cpp:98: DB::CreatingSetsStep::updatePipeline(std::__1::vector<std::__1::unique_ptr<DB::QueryPipeline, std::__1::default_delete<DB::QueryPipeline> >, std::__1::allocator<std::__1::unique_ptr<DB::QueryPipeline, std::__1::default_delete<DB::QueryPipeline> > > >) @ 0x122740c1 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.119295 [ 1089 ] <Fatal> BaseDaemon: 13. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Processors/QueryPlan/QueryPlan.cpp:171: DB::QueryPlan::buildQueryPipeline() @ 0x122b4a73 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.159126 [ 1089 ] <Fatal> BaseDaemon: 14. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:340: DB::InterpreterSelectWithUnionQuery::execute() @ 0x115af1ef in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.200966 [ 1089 ] <Fatal> BaseDaemon: 15. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/executeQuery.cpp:507: DB::executeQueryImpl(char const*, char const*, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, DB::ReadBuffer*) @ 0x1172ce53 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.242855 [ 1089 ] <Fatal> BaseDaemon: 16. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Interpreters/executeQuery.cpp:839: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0x1172b89a in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.289545 [ 1089 ] <Fatal> BaseDaemon: 17. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Server/TCPHandler.cpp:260: DB::TCPHandler::runImpl() @ 0x11f3a4fb in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.335832 [ 1089 ] <Fatal> BaseDaemon: 18. /home/avtokmakov/ch/ClickHouse/build_debug/../src/Server/TCPHandler.cpp:1414: DB::TCPHandler::run() @ 0x11f45a08 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.397075 [ 1089 ] <Fatal> BaseDaemon: 19. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Net/src/TCPServerConnection.cpp:43: Poco::Net::TCPServerConnection::start() @ 0x1679938c in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.457744 [ 1089 ] <Fatal> BaseDaemon: 20. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Net/src/TCPServerDispatcher.cpp:112: Poco::Net::TCPServerDispatcher::run() @ 0x16799b90 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.519713 [ 1089 ] <Fatal> BaseDaemon: 21. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/ThreadPool.cpp:199: Poco::PooledThread::run() @ 0x168cdd13 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.581243 [ 1089 ] <Fatal> BaseDaemon: 22. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/Thread.cpp:56: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x168cac3d in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.643135 [ 1089 ] <Fatal> BaseDaemon: 23. /home/avtokmakov/ch/ClickHouse/build_debug/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345: Poco::ThreadImpl::runnableEntry(void*) @ 0x168c9ac8 in /home/avtokmakov/ch/ClickHouse/build_debug/programs/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.643897 [ 1089 ] <Fatal> BaseDaemon: 24. start_thread @ 0x9609 in /lib/x86_64-linux-gnu/libpthread-2.31.so
[avtokmakov-dev.sas.yp-c.yandex.net] 2020.12.17 14:20:08.644319 [ 1089 ] <Fatal> BaseDaemon: 25. /build/glibc-YYA7BZ/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97: clone @ 0x122103 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so

```

https://clickhouse-test-reports.s3.yandex.net/17642/294e8bbb4e74532af994d0118217ee5c4e4e18f0/fuzzer/fuzzer.log

{
    return ITransformingStep::Traits
    {
        {
            .preserves_distinct_columns = !actions->hasArrayJoin(),
            .returns_single_stream = false,
            .preserves_number_of_streams = true,
            .preserves_sorting = !actions->hasArrayJoin(),
        },
        {
            .preserves_number_of_rows = !actions->hasArrayJoin(),
        }
    };
}
static ITransformingStep::Traits getJoinTraits()
{
    return ITransformingStep::Traits
    {
        {
            .preserves_distinct_columns = false,
            .returns_single_stream = false,
            .preserves_number_of_streams = true,
            .preserves_sorting = false,
        },
        {
            .preserves_number_of_rows = false,
        }
    };
}
ExpressionStep::ExpressionStep(const DataStream & input_stream_, ActionsDAGPtr actions_dag_)