Pull Request Overview
- Opened on September 20, 2026
- Status Open
- Commit count 0
Total Delta
Open Days
Test Delta
How long has this pull request spent in each phase of its lifecycle?
Data pending calculation for pull request
Implement `aggregate_function_input_format` as a header substitution and a transformation on top of every input format
Related: https://github.com/ClickHouse/ClickHouse/pull/91358
Related: https://github.com/ClickHouse/ClickHouse/pull/88088
This is the implementation of aggregate_function_input_format = 'value' and 'array' proposed in https://github.com/ClickHouse/ClickHouse/pull/91358#issuecomment-5746148873, as an alternative to that pull request.
The setting is no longer implemented inside SerializationAggregateFunction for each text escaping rule separately. Instead, FormatFactory::getInput asks the input format to parse a different header, in which every AggregateFunction(f, T...) is replaced with the type of the values f aggregates: T, or Tuple(T...) for several arguments (an empty tuple for count), or Array of it in the array mode. The format reads these values as it reads any column of that type, in its own representation. A new processor, AggregateFunctionStatesFromValuesInputFormat, wraps the format, builds the states from the values with addBatch / addBatchArray, and outputs chunks of the original header. The replacement is applied recursively inside Array, Tuple and Map.
So the setting now works uniformly in every input format, including RowBinary, Native, Parquet and the other binary and columnar formats, with the parallel parsing, with asynchronous inserts, and with defaults for omitted fields, without any format-specific code. SerializationAggregateFunction only reads states again.
What changes for the text formats: the value is written exactly as the format writes the argument type, not as a string containing it. In JSON formats this means {"x": [1, 2, 3]} instead of {"x": "[1,2,3]"} (the string form is not accepted anymore; quoted numbers still are, as for any numeric column). In Values, string literals such as '[1,2,3]' keep working through the usual conversion of the literal to the column type. TSV and CSV are unchanged. A Nullable argument is written as \N or null as usual, and the array elements of a String argument are quoted as in any Array(String).
Changelog category (leave one):
- Improvement
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The setting aggregate_function_input_format with the values value and array now works in every input format, including RowBinary, Native and Parquet, and for AggregateFunction nested in Array, Tuple and Map: the format reads the column as the type of the aggregated values (or an array of them) in its own representation, and the states are built from the values. In the JSON formats the value is now a JSON value, for example {"x": [1, 2, 3]}, not a string containing it.
Documentation entry for user-facing changes
- [x] Documentation is written (the setting description and the
AggregateFunctiondata type andRowBinaryformat documentation in the source code)
๐ค Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/121120]
<!-- CI automatic block end :ci_links: -->
Comments Threads Pending Resolution
Resolved Comment Threads
No resolved comments have been left on this PR.