| 1 | #include <Processors/Formats/IInputFormat.h> | 
|---|---|
| 2 | #include <IO/ReadBuffer.h> | 
| 3 | |
| 4 | |
| 5 | namespace DB | 
| 6 | { | 
| 7 | |
| 8 | namespace ErrorCodes | 
| 9 | { | 
| 10 | extern const int LOGICAL_ERROR; | 
| 11 | } | 
| 12 | |
| 13 | IInputFormat::IInputFormat(Block header, ReadBuffer & in_) | 
| 14 | : ISource(std::move(header)), in(in_) | 
| 15 | { | 
| 16 | } | 
| 17 | |
| 18 | void IInputFormat::resetParser() | 
| 19 | { | 
| 20 | if (in.hasPendingData()) | 
| 21 | throw Exception( "Unread data in IInputFormat::resetParser. Most likely it's a bug.", ErrorCodes::LOGICAL_ERROR); | 
| 22 | |
| 23 | // those are protected attributes from ISource (I didn't want to propagate resetParser up there) | 
| 24 | finished = false; | 
| 25 | got_exception = false; | 
| 26 | |
| 27 | getPort().getInputPort().reopen(); | 
| 28 | } | 
| 29 | |
| 30 | } | 
| 31 | 
