ClickHouse/dbms/src/Processors/Formats/Impl/JSONEachRowRowOutputFormat.h

41 lines
976 B
C++
Raw Normal View History

2019-02-19 18:41:18 +00:00
#pragma once
#include <Core/Block.h>
#include <IO/WriteBuffer.h>
#include <Processors/Formats/IRowOutputFormat.h>
#include <Formats/FormatSettings.h>
namespace DB
{
/** The stream for outputting data in JSON format, by object per line.
* Does not validate UTF-8.
*/
class JSONEachRowRowOutputFormat : public IRowOutputFormat
{
public:
2019-08-03 11:02:40 +00:00
JSONEachRowRowOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & settings_);
2019-02-19 18:41:18 +00:00
String getName() const override { return "JSONEachRowRowOutputFormat"; }
void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
void writeFieldDelimiter() override;
void writeRowStartDelimiter() override;
void writeRowEndDelimiter() override;
2019-07-31 10:06:46 +00:00
protected:
/// No totals and extremes.
void consumeTotals(Chunk) override {}
void consumeExtremes(Chunk) override {}
2019-02-19 18:41:18 +00:00
private:
size_t field_number = 0;
Names fields;
FormatSettings settings;
};
}