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-20 11:17:57 +00:00
|
|
|
JSONEachRowRowOutputFormat(WriteBuffer & out_, const Block & header_, FormatFactory::WriteCallback callback, 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
|
|
|
size_t field_number = 0;
|
2019-08-09 15:58:07 +00:00
|
|
|
|
|
|
|
private:
|
2019-02-19 18:41:18 +00:00
|
|
|
Names fields;
|
|
|
|
|
|
|
|
FormatSettings settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|