1/* Copyright (c) 2018 BlackBerry Limited
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6http://www.apache.org/licenses/LICENSE-2.0
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License. */
12#pragma once
13
14#include <Core/QueryProcessingStage.h>
15#include <DataStreams/BlockIO.h>
16#include <DataStreams/IBlockInputStream.h>
17#include <Parsers/IAST_fwd.h>
18#include <Interpreters/IInterpreter.h>
19#include <Storages/SelectQueryInfo.h>
20#include <Storages/IStorage.h>
21#include <Interpreters/Context.h>
22
23namespace DB
24{
25
26class IAST;
27using ASTPtr = std::shared_ptr<IAST>;
28using StoragePtr = std::shared_ptr<IStorage>;
29
30class InterpreterWatchQuery : public IInterpreter
31{
32public:
33 InterpreterWatchQuery(const ASTPtr & query_ptr_, Context & context_)
34 : query_ptr(query_ptr_), context(context_) {}
35
36 BlockIO execute() override;
37
38private:
39 ASTPtr query_ptr;
40 Context & context;
41
42 BlockInputStreamPtr executeImpl();
43 /// Table from where to read data, if not subquery.
44 StoragePtr storage;
45 /// Streams of read data
46 BlockInputStreams streams;
47};
48
49
50}
51