**Describe the bug**
`SELECT i FROM generateRandom('i Array(Int8)', 1048575, 10, 1048577) LIMIT 1048575`

Memory limit should be respected.
res.in->setProcessListElement(context.getProcessListElement());
                if (stage == QueryProcessingStage::Complete)
                {
                    if (!interpreter->ignoreQuota())
                        res.in->setQuota(quota);
                    if (!interpreter->ignoreLimits())
                        res.in->setLimits(limits);
                }
            }
            if (res.out)
            {
                if (auto * stream = dynamic_cast<CountingBlockOutputStream *>(res.out.get()))
                {
                    stream->setProcessListElement(context.getProcessListElement());
                }
            }
        }
        
        {
            QueryLogElement elem;
            elem.type = QueryLogElementType::QUERY_START;
            elem.event_time = current_time;
            elem.event_time_microseconds = current_time_microseconds;
            elem.query_start_time = current_time;
            elem.query_start_time_microseconds = current_time_microseconds;
            elem.current_database = context.getCurrentDatabase();
            elem.query = query_for_logging;
            elem.client_info = context.getClientInfo();
            bool log_queries = settings.log_queries && !internal;