-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[client-v2] V2 implement writer api #2034
Conversation
settings.getInputStreamCopyBufferSize(); | ||
|
||
if (writeBufferSize <= 0) { | ||
throw new IllegalArgumentException("Buffer size must be greater than 0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we can not do that in InsertSettings
and throw the exception from there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this value can be set by two method setInputStreamCopyBufferSize
and setOption
and here I'm doing specific calculation.
One more reason - I keep validation here because it is implementation specific code for this operation. InsertSettings should not be aware of this validation because they may be used for other purposes.
@@ -104,7 +104,7 @@ public enum ClientConfigProperties { | |||
|
|||
QUERY_ID("query_id"), // actually a server setting, but has client effect too | |||
|
|||
CLIENT_NETWORK_BUFFER_SIZE("client_network_buffer_size"), | |||
CLIENT_NETWORK_BUFFER_SIZE("client_network_buffer_size", "8192"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets extract it to a const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done -> com.clickhouse.client.api.Client.Builder#DEFAULT_BUFFER_SIZE
Quality Gate failedFailed conditions |
Summary
Implements new Writer style API for insert operations.
Writer API intended to work:
Main change:
com.clickhouse.client.api.Client#insert(java.lang.String, com.clickhouse.client.api.DataStreamWriter, com.clickhouse.data.ClickHouseFormat, com.clickhouse.client.api.insert.InsertSettings)
- intriduces ability to use data stream writer that can control how to write data.Current PR introduces two new experimental classes:
com.clickhouse.client.api.data_formats.RowBinaryFormatWriter
- Intend to simplify writing RowBinary encoded datacom.clickhouse.client.api.data_formats.RowBinaryFormatSerializer
- very low-level serializer for RowBinary encoding. For very advanced users.Checklist
Delete items not relevant to your PR: