Aggregate function input format#88049
Closed
punithsubashchandra wants to merge 10 commits intoClickHouse:masterfrom
Closed
Aggregate function input format#88049punithsubashchandra wants to merge 10 commits intoClickHouse:masterfrom
punithsubashchandra wants to merge 10 commits intoClickHouse:masterfrom
Conversation
|
|
Contributor
|
Workflow [PR], commit [d9d47db] Summary: ❌
|
Contributor
|
There is also opposite requirement. #29109 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
This change adds a new session-level setting in FormatSettings called aggregate_function_input_format.
It supports the following values:
It improves
INSERTqueries into tables with AggregateFunction columns, allowing you to insert data either as serialized state, as raw values, as arrays of values or as json .Fixes #87827.
Documentation entry for user-facing changes :
Adds a Session level setting
aggregate_function_input_formatwith the following possible values:state- binary string with the serialized state (the default);value- the format will expect a single value of the argument of the aggregate function, or in the case of multiple arguments, a tuple of them; that will be deserialized to form the relevant state.array- the format will expect an Array of values, as described in the values option above; all the elements of the array will be aggregated to form the state.The goal of this PR is to allow the usage of
AggregateFunctionto support various other formats like 'JSON', 'CSV' ,'TSV'Example use: A query or command:
For a table with this structure :
CREATE TABLE test_agg_single ( user_id UInt64, avg_session_length AggregateFunction(avg, UInt32) )the user can
SET aggregate_function_input_format = 'value'and perform queries such as :INSERT INTO test_agg_single VALUES (124, '456'), (125, '789'), (126, '321');or
the user can
SET aggregate_function_input_format = 'array'INSERT INTO test_agg_single VALUES (127, '[100,200,300]'), (128, '[400,500]'), (129, '[600]');