Skip to content

Add QuerySettings overloads to Client::Insert - #599

Open
goel-skd wants to merge 1 commit into
ClickHouse:masterfrom
goel-skd:insert-query-settings
Open

goel-skd wants to merge 1 commit into
ClickHouse:masterfrom
goel-skd:insert-query-settings

Conversation

@goel-skd

Copy link
Copy Markdown

Closes #565

Client::Insert() built its own Query and sent it with empty settings, so per-insert settings like insert_deduplication_token or async_insert could not be used with native-format inserts.

This adds two overloads:

void Insert(const std::string& table_name, const Block& block, const QuerySettings& settings);
void Insert(const std::string& table_name, const std::string& query_id, const Block& block,
            const QuerySettings& settings);

The existing overloads are unchanged and send no settings.

BeginInsert(const Query&), which the issue also mentions, already sends the full Query on master, so it needed no change. The new test covers it.

Test: ClientCase.InsertWithQuerySettings creates a MergeTree table with non_replicated_deduplication_window and checks that identical blocks are deduplicated without a token or with a repeated token, and kept with different tokens, through both Insert() and BeginInsert(). It also checks that an unknown IMPORTANT setting throws ServerException.

The README's async-insert section no longer lists native Insert() as unsupported.

Insert() built its own Query and always sent it with empty settings, so
per-insert settings such as insert_deduplication_token or async_insert
could not be used with native-format inserts.

Closes ClickHouse#565
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow optional QuerySettings on Client::Insert() for native-format inserts

2 participants