| 1 | /* Copyright (c) 2018 BlackBerry Limited |
|---|---|
| 2 | |
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | you may not use this file except in compliance with the License. |
| 5 | You may obtain a copy of the License at |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | Unless required by applicable law or agreed to in writing, software |
| 8 | distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | See the License for the specific language governing permissions and |
| 11 | limitations 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 | |
| 23 | namespace DB |
| 24 | { |
| 25 | |
| 26 | class IAST; |
| 27 | using ASTPtr = std::shared_ptr<IAST>; |
| 28 | using StoragePtr = std::shared_ptr<IStorage>; |
| 29 | |
| 30 | class InterpreterWatchQuery : public IInterpreter |
| 31 | { |
| 32 | public: |
| 33 | InterpreterWatchQuery(const ASTPtr & query_ptr_, Context & context_) |
| 34 | : query_ptr(query_ptr_), context(context_) {} |
| 35 | |
| 36 | BlockIO execute() override; |
| 37 | |
| 38 | private: |
| 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 |