#pragma once #include #include #include #include #include namespace DB { /** The stream for outputting data in JSON format, by JSON array per line. */ class JSONCompactEachRowRowOutputFormat final : public RowOutputFormatWithExceptionHandlerAdaptor { public: JSONCompactEachRowRowOutputFormat( WriteBuffer & out_, const Block & header_, const FormatSettings & settings_, bool with_names_, bool with_types_, bool yield_strings_); String getName() const override { return "JSONCompactEachRowRowOutputFormat"; } private: void writePrefix() override; void writeTotals(const Columns & columns, size_t row_num) override; void writeField(const IColumn & column, const ISerialization & serialization, size_t row_num) override; void writeFieldDelimiter() override; void writeRowStartDelimiter() override; void writeRowEndDelimiter() override; void writeSuffix() override; void resetFormatterImpl() override; bool supportTotals() const override { return true; } void consumeTotals(Chunk) override; void writeLine(const std::vector & values); FormatSettings settings; bool with_names; bool with_types; bool yield_strings; WriteBuffer * ostr; }; }