```
CREATE TABLE test1__fuzz_37 (`i` Date) ENGINE = MergeTree ORDER BY i;
insert into test1__fuzz_37 values ('2020-10-10');
SELECT count() FROM test1__fuzz_37 GROUP BY dictHas(NULL, (dictHas(NULL, (('', materialize(NULL)), materialize(NULL))), 'KeyKey')), dictHas('test_dictionary', tuple(materialize('Ke\0'))), tuple(dictHas(NULL, (tuple('Ke\0Ke\0Ke\0Ke\0Ke\0Ke\0\0\0\0Ke\0'), materialize(NULL)))), 'test_dicti\0nary', (('', materialize(NULL)), dictHas(NULL, (dictHas(NULL, tuple(materialize(NULL))), 'KeyKeyKeyKeyKeyKeyKeyKey')), materialize(NULL));

SELECT count()
FROM test1__fuzz_37
GROUP BY
    dictHas(NULL, (dictHas(NULL, (('', materialize(NULL)), materialize(NULL))), 'KeyKey')),
    dictHas('test_dictionary', tuple(materialize('Ke\0'))),
    tuple(dictHas(NULL, (tuple('Ke\0Ke\0Ke\0Ke\0Ke\0Ke\0\0\0\0Ke\0'), materialize(NULL)))),
    'test_dicti\0nary',
    (('', materialize(NULL)), dictHas(NULL, (dictHas(NULL, tuple(materialize(NULL))), 'KeyKeyKeyKeyKeyKeyKeyKey')), materialize(NULL))

Query id: 17710b2b-8955-418c-ae25-0eb422078d94


0 rows in set. Elapsed: 0.014 sec. 

Received exception from server (version 22.13.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Context has expired: while executing 'FUNCTION dictHas('test_dictionary' :: 3, tuple(materialize('Ke\0')) :: 10) -> dictHas('test_dictionary', tuple(materialize('Ke\0'))) UInt8 : 5'. (LOGICAL_ERROR)

{18802d15-8cb4-4d5e-84f5-680741d0e406} <Error> executeQuery: Code: 49. DB::Exception: Context has expired: while executing 'FUNCTION dictHas('test_dictionary' :: 3, tuple(materialize('Ke\0')) :: 10) -> dictHas('test_dictionary', tuple(materialize('Ke\0'))) UInt8 : 5'. (LOGICAL_ERROR) (version 22.13.1.1) (from [::ffff:127.0.0.1]:47550) (in query: SELECT count() FROM test1__fuzz_37 GROUP BY dictHas(NULL, (dictHas(NULL, (('', materialize(NULL)), materialize(NULL))), 'KeyKey')), dictHas('test_dictionary', tuple(materialize('Ke\0'))), tuple(dictHas(NULL, (tuple('Ke\0Ke\0Ke\0Ke\0Ke\0Ke\0\0\0\0Ke\0'), materialize(NULL)))), 'test_dicti\0nary', (('', materialize(NULL)), dictHas(NULL, (dictHas(NULL, tuple(materialize(NULL))), 'KeyKeyKeyKeyKeyKeyKeyKey')), materialize(NULL))), Stack trace (when copying this message, always include the lines below):

0. ./build/./contrib/llvm-project/libcxx/include/exception:134: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x164d7193 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
1. ./build/./src/Common/Exception.cpp:77: DB::Exception::Exception(DB::Exception::MessageMasked const&, int, bool) @ 0xf828afa in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
2. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, bool) @ 0xaada74d in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
3. DB::WithContextImpl<std::__1::shared_ptr<DB::Context const>>::getContext() const @ 0xaf08fb6 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
4. DB::FunctionDictHelper::getDictionary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0xb0e77dc in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
5. DB::FunctionDictHas::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0xb0e6791 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
6. DB::FunctionToExecutableFunctionAdaptor::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0xaada8ce in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
7. ./build/./src/Functions/IFunction.cpp:0: DB::IExecutableFunction::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x13b8c6c7 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
8. ./build/./contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:115: DB::IExecutableFunction::executeWithoutSparseColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x13b8cf0c in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
9. ./build/./src/Functions/IFunction.cpp:0: DB::IExecutableFunction::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName>> const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x13b8dfad in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
10. ./build/./contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:115: DB::ExpressionActions::execute(DB::Block&, unsigned long&, bool) const @ 0x1436ecad in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
11. ./build/./src/Processors/Transforms/ExpressionTransform.cpp:0: DB::ExpressionTransform::transform(DB::Chunk&) @ 0x15b482fc in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
12. ./build/./contrib/llvm-project/libcxx/include/__utility/swap.h:35: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x11e05ef0 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
13. ./build/./src/Processors/ISimpleTransform.cpp:99: DB::ISimpleTransform::work() @ 0x159844b6 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
14. ./build/./contrib/llvm-project/libcxx/include/list:616: DB::ExecutionThreadContext::executeTask() @ 0x1599fb60 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
15. ./build/./src/Processors/Executors/PipelineExecutor.cpp:229: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x15995b5a in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
16. ./build/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:701: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x15995451 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
17. ./build/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:274: DB::PipelineExecutor::execute(unsigned long) @ 0x159952f8 in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
18. ./build/./src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:0: void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()>>(std::__1::__function::__policy_storage const*) @ 0x159a270a in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
19. ./build/./base/base/../base/wide_integer_impl.h:786: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xf8df19c in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
20. ./build/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:302: void* std::__1::__thread_proxy[abi:v15000]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>>(void*) @ 0xf8e256e in /home/ubuntu/dev/ClickHouse/build/programs/clickhouse
21. ? @ 0x7f5e2c8a0609 in ?
22. clone @ 0x7f5e2c7c5133 in ?

```

https://s3.amazonaws.com/clickhouse-test-reports/44824/b859cc2ddcf70e78caa54c56422841f74f26f72c/fuzzer_astfuzzerasan/report.html
size_t reduce_bytes = 0;
            size_t reduce_rows = 0;
            size_t reduce_parts = 0;
            for (const auto & part : precommitted_parts)
            {
                DataPartPtr covering_part;
                DataPartsVector covered_parts = data.getActivePartsToReplace(part->info, part->name, covering_part, *owing_parts_lock);
                if (covering_part)
                {
                    
                    
                    
                    if (part->info.level)
                        LOG_WARNING(data.log, "Tried to commit obsolete part {} covered by {}", part->name, covering_part->getNameWithState());
                    else
                        LOG_INFO(data.log, "Tried to commit obsolete part {} covered by {}", part->name, covering_part->getNameWithState());
                    part->remove_time.store(0, std::memory_order_relaxed); 
                    data.modifyPartState(part, DataPartState::Outdated);
                }
                else
                {
                    if (!txn)
                        MergeTreeTransaction::addNewPartAndRemoveCovered(data.shared_from_this(), part, covered_parts, NO_TRANSACTION_RAW);
                    total_covered_parts.insert(total_covered_parts.end(), covered_parts.begin(), covered_parts.end());
                    for (const auto & covered_part : covered_parts)
                    {
                        covered_part->remove_time.store(current_time, std::memory_order_relaxed);
                        reduce_bytes += covered_part->getBytesOnDisk();
                        reduce_rows += covered_part->rows_count;
                        data.modifyPartState(covered_part, DataPartState::Outdated);