
Clickhouse got stuck and had thrown a coredump
Optimize table process has been started there before the fail


**Does it reproduce on recent release?**

v22.3.6.5-lts

**Error message and/or stacktrace**

https://pastila.nl/?00ea0713/9ad972e00fde60564ff00853050fcc1d

Can't provide the coredump file for NDA reason, but ready to analyse it


{
public:
    struct Data
    {
        const TablesWithColumns & tables;
        ContextPtr context;
        const std::unordered_set<String> & group_by_function_hashes;
        Monotonicity monotonicity = { .is_monotonic = true, .is_positive = true, .is_always_monotonic = true };
        ASTIdentifier * identifier = nullptr;
        DataTypePtr arg_data_type = {};
        void reject() { monotonicity.is_monotonic = false; }
        bool isRejected() const { return !monotonicity.is_monotonic; }
        bool canOptimize(const ASTFunction & ast_function) const
        {
            
            auto hash = ast_function.getTreeHash();
            String key = toString(hash.first) + '_' + toString(hash.second);
            if (group_by_function_hashes.count(key))
                return false;
            
            
            if (ast_function.is_window_function
                || AggregateUtils::isAggregateFunction(ast_function))
            {
                return false;
            }
            return true;
        }
        bool extractIdentifierAndType(const ASTFunction & ast_function)