```
/4/ :) SELECT arrayJoin([1, 2])  GROUP BY 1 WITH TOTALS FORMAT JSON

{
	"meta":
	[
		{
			"name": "arrayJoin([1, 2])",
			"type": "UInt8"
		}
	],

	"data":
	[
		{
			"arrayJoin([1, 2])": 1
		},
		{
			"arrayJoin([1, 2])": 2
		}← Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Logical error: 'Got 2 in totals chunk, expected 1'.
clickhouse-client: /home/akuzm/ch4/ch/src/Common/Exception.cpp:45: DB::Exception::Exception(const std::string &, int): Assertion `false' failed.
Aborted (core dumped)
```


resultset_format = ParsedTemplateFormatString(
                    FormatSchemaInfo(settings.template_settings.resultset_format, "Template", false,
                            settings.schema.is_server, settings.schema.format_schema_path),
                    [&](const String & partName)
                    {
                        return static_cast<size_t>(TemplateBlockOutputFormat::stringToResultsetPart(partName));
                    });
        }
        ParsedTemplateFormatString row_format = ParsedTemplateFormatString(
                FormatSchemaInfo(settings.template_settings.row_format, "Template", false,
                        settings.schema.is_server, settings.schema.format_schema_path),
                [&](const String & colName)
                {
                    return sample.getPositionByName(colName);
                });
        return std::make_shared<TemplateBlockOutputFormat>(sample, buf, settings, resultset_format, row_format, settings.template_settings.row_between_delimiter);
    });
    factory.registerOutputFormatProcessor("CustomSeparated", [](
            WriteBuffer & buf,
            const Block & sample,
            FormatFactory::WriteCallback,
            const FormatSettings & settings)
    {
        ParsedTemplateFormatString resultset_format = ParsedTemplateFormatString::setupCustomSeparatedResultsetFormat(settings.custom);
        ParsedTemplateFormatString row_format = ParsedTemplateFormatString::setupCustomSeparatedRowFormat(settings.custom, sample);
        return std::make_shared<TemplateBlockOutputFormat>(sample, buf, settings, resultset_format, row_format, settings.custom.row_between_delimiter);
    });
}
}