https://s3.amazonaws.com/clickhouse-test-reports/42033/ebdfbf43db5e5eacaff81b4a3dd55c5a285ee025/fuzzer_astfuzzerasan//report.html
How to reproduce:
```
:) create table data_02295 (b Int64, a Int64, grp_aggreg AggregateFunction(groupArrayArray, Array(UInt64))) engine = MergeTree() order by a;
:) set allow_experimental_analyzer=1;
:) SELECT grp_aggreg FROM data_02295 WHERE JSONLength(grp_aggreg, 100, NULL) SETTINGS optimize_aggregation_in_order = 1;
```

CC: @kitaisreal 
{
    if (query.table_function)
    {
        const auto & factory = TableFunctionFactory::instance();
        TableFunctionPtr table_function_ptr = factory.get(query.table_function, getContext());
        
        
        if (query.select && table_function_ptr->needStructureHint())
        {
            InterpreterSelectWithUnionQuery interpreter_select{
                query.select, getContext(), SelectQueryOptions(QueryProcessingStage::Complete, 1)};
            auto tmp_pipeline = interpreter_select.buildQueryPipeline();
            ColumnsDescription structure_hint{tmp_pipeline.getHeader().getNamesAndTypesList()};
            table_function_ptr->setStructureHint(structure_hint);
        }
        return table_function_ptr->execute(query.table_function, getContext(), table_function_ptr->getName(),
                                            {},  false, true);
    }
    if (query.table_id)
    {
        query.table_id = getContext()->resolveStorageID(query.table_id);
    }
    else
    {
        
        
        StorageID local_table_id(query.getDatabase(), query.getTable());