```
2021.06.14 04:05:13.138222 [ 486247 ] {99e5833a-7373-48a4-90f6-a4fd4b24d38c} <Debug> executeQuery: (from 127.0.0.1:41512, using experimental parser) (comment: /home/milovidov/work/ClickHouse/tests/queries/0_stateless/01888_bloom_filter_hasAny.sql) SELECT count() FROM bftest WHERE hasAny(x, []) FORMAT Null;
2021.06.14 04:05:13.138746 [ 486247 ] {99e5833a-7373-48a4-90f6-a4fd4b24d38c} <Trace> ContextAccess (default): Access granted: SELECT(x) ON test_8a76wg.bftest
2021.06.14 04:05:13.138821 [ 486247 ] {99e5833a-7373-48a4-90f6-a4fd4b24d38c} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
2021.06.14 04:05:13.139102 [ 486247 ] {99e5833a-7373-48a4-90f6-a4fd4b24d38c} <Debug> test_8a76wg.bftest (de8c8a47-fadd-4134-9e8c-8a47fadd5134) (SelectExecutor): Key condition: unknown
../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:237:55: runtime error: member access within null pointer of type 'std::__1::shared_ptr<DB::IAST>::element_type' (aka 'DB::IAST')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:237:55 in 
2021.06.14 04:05:13.139699 [ 436617 ] {} <Trace> BaseDaemon: Received signal -3
2021.06.14 04:05:13.139848 [ 486561 ] {} <Fatal> BaseDaemon: ########################################
2021.06.14 04:05:13.139925 [ 486561 ] {} <Fatal> BaseDaemon: (version 21.7.1.1, build id: 420267170D40873D5C34F632BC95713D86824870) (from thread 486247) (query_id: 99e5833a-7373-48a4-90f6-a4fd4b24d38c) Received signal Unknown signal (-3)
2021.06.14 04:05:13.139953 [ 486561 ] {} <Fatal> BaseDaemon: Sanitizer trap.
2021.06.14 04:05:13.140009 [ 486561 ] {} <Fatal> BaseDaemon: Stack trace: 0xf787565 0x1bae4c56 0xf747ff6 0xf75385f 0x1d4854fa 0x1d484bdc 0x1d48492f 0x1d489a4d 0x1d4a2d95 0x1d4a2678 0x1d489d0a 0x1d48375f 0x1d47f770 0x1d47f04c 0x1d47ee75 0x1d47cda1 0x1d417206 0x1db71576 0x1db72c50 0x1db437c1 0x1db5bf45 0x1c93ac10 0x1cba68bf 0x1cba509f 0x1d717cae 0x1d73412d 0x1e75858c 0x1e758a6c 0x1e84457a 0x1e84212c 0x7fc629201609 0x7fc629128293
2021.06.14 04:05:13.156059 [ 486561 ] {} <Fatal> BaseDaemon: 0.1. inlined from /home/milovidov/work/ClickHouse/build/../src/Common/StackTrace.cpp:304: StackTrace::tryCapture()
2021.06.14 04:05:13.156073 [ 486561 ] {} <Fatal> BaseDaemon: 0. ../src/Common/StackTrace.cpp:265: StackTrace::StackTrace() @ 0xf787565 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.190808 [ 486561 ] {} <Fatal> BaseDaemon: 1. /home/milovidov/work/ClickHouse/build/../base/daemon/BaseDaemon.cpp:381: sanitizerDeathCallback() @ 0x1bae4c56 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.193580 [ 486561 ] {} <Fatal> BaseDaemon: 2. /home/milovidov/work/ClickHouse/utils/ci/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:54: __sanitizer::Die() @ 0xf747ff6 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.690490 [ 486561 ] {} <Fatal> BaseDaemon: 3. ? @ 0xf75385f in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.720029 [ 486561 ] {} <Fatal> BaseDaemon: 4. /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:235: DB::MergeTreeIndexConditionBloomFilter::traverseFunction(std::__1::shared_ptr<DB::IAST> const&, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&, std::__1::shared_ptr<DB::IAST> const&) @ 0x1d4854fa in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.748622 [ 486561 ] {} <Fatal> BaseDaemon: 5.1. inlined from /home/milovidov/work/ClickHouse/build/../contrib/libcxx/include/iterator:1496: std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST> const*>::operator++()
2021.06.14 04:05:13.748643 [ 486561 ] {} <Fatal> BaseDaemon: 5. ../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:238: DB::MergeTreeIndexConditionBloomFilter::traverseFunction(std::__1::shared_ptr<DB::IAST> const&, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&, std::__1::shared_ptr<DB::IAST> const&) @ 0x1d484bdc in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.777397 [ 486561 ] {} <Fatal> BaseDaemon: 6. /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:0: DB::MergeTreeIndexConditionBloomFilter::traverseAtomAST(std::__1::shared_ptr<DB::IAST> const&, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&) @ 0x1d48492f in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.821716 [ 486561 ] {} <Fatal> BaseDaemon: 7.1. inlined from /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:0: operator()<const std::__1::shared_ptr<DB::IAST>, std::__1::shared_ptr<const DB::Context>, DB::Block, DB::MergeTreeIndexConditionBloomFilter::RPNElement>
2021.06.14 04:05:13.821741 [ 486561 ] {} <Fatal> BaseDaemon: 7. ../contrib/libcxx/include/type_traits:3676: decltype(std::__1::forward<DB::MergeTreeIndexConditionBloomFilter::MergeTreeIndexConditionBloomFilter(DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, DB::Block const&, unsigned long)::$_0&>(fp)(std::__1::forward<std::__1::shared_ptr<DB::IAST> const&>(fp0), std::__1::forward<std::__1::shared_ptr<DB::Context const> >(fp0), std::__1::forward<DB::Block&>(fp0), std::__1::forward<DB::MergeTreeIndexConditionBloomFilter::RPNElement&>(fp0))) std::__1::__invoke<DB::MergeTreeIndexConditionBloomFilter::MergeTreeIndexConditionBloomFilter(DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, DB::Block const&, unsigned long)::$_0&, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&>(DB::MergeTreeIndexConditionBloomFilter::MergeTreeIndexConditionBloomFilter(DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, DB::Block const&, unsigned long)::$_0&, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>&&, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&) @ 0x1d489a4d in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.866560 [ 486561 ] {} <Fatal> BaseDaemon: 8. /home/milovidov/work/ClickHouse/build/../contrib/libcxx/include/functional:0: std::__1::function<bool (std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&)>::operator()(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&) const @ 0x1d4a2d95 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.895353 [ 486561 ] {} <Fatal> BaseDaemon: 9. /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/RPNBuilder.h:82: DB::RPNBuilder<DB::MergeTreeIndexConditionBloomFilter::RPNElement>::traverseAST(std::__1::shared_ptr<DB::IAST> const&) @ 0x1d4a2678 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.922895 [ 486561 ] {} <Fatal> BaseDaemon: 10. /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/RPNBuilder.h:0: DB::RPNBuilder<DB::MergeTreeIndexConditionBloomFilter::RPNElement>::RPNBuilder(DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, std::__1::function<bool (std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::Block&, DB::MergeTreeIndexConditionBloomFilter::RPNElement&)> const&) @ 0x1d489d0a in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.949148 [ 486561 ] {} <Fatal> BaseDaemon: 11. /home/milovidov/work/ClickHouse/build/../src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp:94: DB::MergeTreeIndexConditionBloomFilter::MergeTreeIndexConditionBloomFilter(DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, DB::Block const&, unsigned long) @ 0x1d48375f in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:13.983655 [ 486561 ] {} <Fatal> BaseDaemon: 12. /home/milovidov/work/ClickHouse/build/../contrib/libcxx/include/memory:887: void std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter>::construct<DB::MergeTreeIndexConditionBloomFilter, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&>(DB::MergeTreeIndexConditionBloomFilter*, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&) @ 0x1d47f770 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:14.017875 [ 486561 ] {} <Fatal> BaseDaemon: 13. /home/milovidov/work/ClickHouse/build/../contrib/libcxx/include/memory:2598: std::__1::__shared_ptr_emplace<DB::MergeTreeIndexConditionBloomFilter, std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter> >::__shared_ptr_emplace<DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&>(std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter>, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&) @ 0x1d47f04c in /home/milovidov/work/ClickHouse/build/programs/clickhouse
2021.06.14 04:05:14.052271 [ 486561 ] {} <Fatal> BaseDaemon: 14.1. inlined from /home/milovidov/work/ClickHouse/build/../contrib/libcxx/include/__memory/utilities.h:68: std::__1::__allocation_guard<std::__1::allocator<std::__1::__shared_ptr_emplace<DB::MergeTreeIndexConditionBloomFilter, std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter> > > >::__release_ptr()
2021.06.14 04:05:14.052292 [ 486561 ] {} <Fatal> BaseDaemon: 14. ../contrib/libcxx/include/memory:3361: std::__1::shared_ptr<DB::MergeTreeIndexConditionBloomFilter> std::__1::allocate_shared<DB::MergeTreeIndexConditionBloomFilter, std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter>, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&, void>(std::__1::allocator<DB::MergeTreeIndexConditionBloomFilter> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>&, DB::Block const&, unsigned long const&) @ 0x1d47ee75 in /home/milovidov/work/ClickHouse/build/programs/clickhouse
```
{
    const auto * const_column = typeid_cast<const ColumnConst *>(hash_column);
    const auto * non_const_column = typeid_cast<const ColumnUInt64 *>(hash_column);
    if (!const_column && !non_const_column)
        throw Exception("LOGICAL ERROR: hash column must be Const Column or UInt64 Column.", ErrorCodes::LOGICAL_ERROR);
    if (const_column)
    {
        for (size_t index = 0; index < hash_functions; ++index)
            if (!bloom_filter->findHashWithSeed(const_column->getValue<UInt64>(), BloomFilterHash::bf_hash_seed[index]))
                return false;
        return true;
    }
    else
    {
        bool missing_rows = true;
        const ColumnUInt64::Container & data = non_const_column->getData();
        for (size_t index = 0, size = data.size(); missing_rows && index < size; ++index)
        {
            bool match_row = true;
            for (size_t hash_index = 0; match_row && hash_index < hash_functions; ++hash_index)
                match_row = bloom_filter->findHashWithSeed(data[index], BloomFilterHash::bf_hash_seed[hash_index]);
            missing_rows = !match_row;
        }
        return !missing_rows;
    }
}
}
MergeTreeIndexConditionBloomFilter::MergeTreeIndexConditionBloomFilter(