```
/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)
```


case static_cast<size_t>(ResultsetPart::Rows):
            case static_cast<size_t>(ResultsetPart::RowsBeforeLimit):
            case static_cast<size_t>(ResultsetPart::TimeElapsed):
            case static_cast<size_t>(ResultsetPart::RowsRead):
            case static_cast<size_t>(ResultsetPart::BytesRead):
                if (format.formats[i] == ColumnFormat::None)
                    format.throwInvalidFormat("Serialization type for output part rows, rows_before_limit, time, "
                                              "rows_read or bytes_read is not specified", i);
                break;
            default:
                format.throwInvalidFormat("Invalid output part", i);
        }
    }
    if (data_idx != 0)
        format.throwInvalidFormat("${data} must be the first output part", 0);
    
    if (row_format.delimiters.size() == 1)
        row_format.throwInvalidFormat("No columns specified", 0);
    for (size_t i = 0; i < row_format.columnsCount(); ++i)
    {
        if (!row_format.format_idx_to_column_idx[i])
            row_format.throwInvalidFormat("Cannot skip format field for output, it's a bug.", i);
        if (header_.columns() <= *row_format.format_idx_to_column_idx[i])
            row_format.throwInvalidFormat("Column index " + std::to_string(*row_format.format_idx_to_column_idx[i]) +
                                          " must be less then number of columns (" + std::to_string(header_.columns()) + ")", i);
        if (row_format.formats[i] == ColumnFormat::None)
            row_format.throwInvalidFormat("Serialization type for file column is not specified", i);
    }
}
TemplateBlockOutputFormat::ResultsetPart TemplateBlockOutputFormat::stringToResultsetPart(const String & part)