ClickHouse/dbms/include/DB/DataStreams/TabSeparatedRowInputStream.h

35 lines
816 B
C
Raw Normal View History

2011-08-09 19:19:00 +00:00
#pragma once
2010-05-21 19:53:44 +00:00
#include <Poco/SharedPtr.h>
2011-11-06 05:01:42 +00:00
#include <DB/Core/Block.h>
2010-06-04 18:25:25 +00:00
#include <DB/IO/ReadBuffer.h>
2010-05-21 19:53:44 +00:00
#include <DB/DataStreams/IRowInputStream.h>
namespace DB
{
2012-11-10 04:43:04 +00:00
/** Поток для ввода данных в формате tsv.
2010-05-21 19:53:44 +00:00
*/
class TabSeparatedRowInputStream : public IRowInputStream
{
public:
2011-11-06 06:22:52 +00:00
/** with_names - в первой строке заголовок с именами столбцов
* with_types - на следующей строке заголовок с именами типов
*/
TabSeparatedRowInputStream(ReadBuffer & istr_, const Block & sample_, bool with_names_ = false, bool with_types_ = false);
2010-05-21 19:53:44 +00:00
bool read(Row & row) override;
void readPrefix() override;
2010-05-21 19:53:44 +00:00
private:
2010-06-04 18:25:25 +00:00
ReadBuffer & istr;
2012-10-10 18:32:45 +00:00
const Block sample;
2011-11-06 06:22:52 +00:00
bool with_names;
bool with_types;
2011-11-06 05:01:42 +00:00
DataTypes data_types;
2010-05-21 19:53:44 +00:00
};
}