| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <Processors/ISource.h> | 
|---|
| 4 |  | 
|---|
| 5 |  | 
|---|
| 6 | namespace DB | 
|---|
| 7 | { | 
|---|
| 8 |  | 
|---|
| 9 | class ReadBuffer; | 
|---|
| 10 |  | 
|---|
| 11 | /** Input format is a source, that reads data from ReadBuffer. | 
|---|
| 12 | */ | 
|---|
| 13 | class IInputFormat : public ISource | 
|---|
| 14 | { | 
|---|
| 15 | protected: | 
|---|
| 16 |  | 
|---|
| 17 | /// Skip GCC warning: ‘maybe_unused’ attribute ignored | 
|---|
| 18 | #pragma GCC diagnostic push | 
|---|
| 19 | #pragma GCC diagnostic ignored "-Wattributes" | 
|---|
| 20 |  | 
|---|
| 21 | ReadBuffer & in [[maybe_unused]]; | 
|---|
| 22 |  | 
|---|
| 23 | #pragma GCC diagnostic pop | 
|---|
| 24 |  | 
|---|
| 25 | public: | 
|---|
| 26 | IInputFormat(Block , ReadBuffer & in_); | 
|---|
| 27 |  | 
|---|
| 28 | /** In some usecase (hello Kafka) we need to read a lot of tiny streams in exactly the same format. | 
|---|
| 29 | * The recreating of parser for each small stream takes too long, so we introduce a method | 
|---|
| 30 | * resetParser() which allow to reset the state of parser to continue reading of | 
|---|
| 31 | * source stream w/o recreating that. | 
|---|
| 32 | * That should be called after current buffer was fully read. | 
|---|
| 33 | */ | 
|---|
| 34 | virtual void resetParser(); | 
|---|
| 35 |  | 
|---|
| 36 | virtual const BlockMissingValues & getMissingValues() const | 
|---|
| 37 | { | 
|---|
| 38 | static const BlockMissingValues none; | 
|---|
| 39 | return none; | 
|---|
| 40 | } | 
|---|
| 41 | }; | 
|---|
| 42 |  | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|