Repository navigation
Implement the max_insert_block_size_bytes setting for Format Pasing - #92833
Conversation
…mat and Values format
|
Workflow [PR], commit [89b7e4a] Summary: ❌
|
There was a problem hiding this comment.
Pull request overview
This PR implements byte-based block size control for format parsing by adding max_insert_block_size_bytes setting and propagating min/max thresholds to row input formats. The feature enables users to control block formation during data parsing from row-based formats (CSV, TSV, JSONEachRow, Values) across HTTP, gRPC, PostgreSQL wire protocol, and client interfaces.
Key changes:
- Added
max_insert_block_size_bytessetting andmax_insert_block_size_rowsalias formax_insert_block_size - Propagated
min_insert_block_size_rowsandmin_insert_block_size_bytesto format parsing - Updated block formation logic to use AND for min thresholds, OR for max thresholds
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/Settings.cpp | Added new settings definitions and updated documentation for block size control |
| src/Core/SettingsChangesHistory.cpp | Registered new settings in version 26.1 |
| src/Formats/FormatFactory.h | Added optional parameters for byte/row thresholds to getInput |
| src/Formats/FormatFactory.cpp | Updated to accept and apply new block size parameters |
| src/Processors/Formats/IRowInputFormat.h | Extended RowInputFormatParams with min/max byte/row thresholds |
| src/Processors/Formats/IRowInputFormat.cpp | Implemented new block formation logic with min/max threshold checks |
| src/Processors/Formats/Impl/ValuesBlockInputFormat.cpp | Updated to use max_block_size_rows instead of max_block_size |
| src/Processors/Sources/YTsaurusSource.cpp | Renamed parameter from max_block_size to max_block_size_rows |
| src/Interpreters/Context.h | Extended getInputFormat signature with new optional parameters |
| src/Interpreters/Context.cpp | Updated getInputFormat implementation to forward new parameters |
| src/Client/ClientBase.h | Added config fields for all four block size thresholds |
| src/Client/ClientBase.cpp | Updated to read config values and pass all thresholds to format creation |
| src/Client/LocalConnection.cpp | Updated to pass settings for byte/row thresholds |
| src/Server/GRPCServer.cpp | Updated format creation calls with new settings |
| src/Server/PostgreSQLHandler.cpp | Updated format creation with new settings parameters |
| src/Processors/Transforms/getSourceFromASTInsertQuery.cpp | Updated to pass new settings to format creation |
| tests/queries/0_stateless/03722_max_insert_block_size_bytes_client_row_format.sql | Test verifying block formation with different threshold combinations via client |
| tests/queries/0_stateless/03722_max_insert_block_size_bytes_client_row_format.reference | Expected results showing correct part counts |
| tests/queries/0_stateless/03723_max_insert_block_size_bytes_http.sh | Test verifying block formation via HTTP interface |
| tests/queries/0_stateless/03723_max_insert_block_size_bytes_http.reference | Expected results for HTTP test |
Comments suppressed due to low confidence (1)
src/Core/Settings.cpp:118
- The comment line at 62 says "Disable max_insert_block_bytes" but the setting name is actually "max_insert_block_size_bytes". This inconsistency could confuse users.
)", 0) \
|
Failure of Stateless tests (arm_asan, targeted) (cidb) was an issue: #93051 and got resolved in #93227 |
|
Hi @Fgrtue @yariks5s — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
Changelog category:
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Adds new setting
max_insert_block_size_byteswhich control the formation of inserted blocks in finer detail.Resolved step 1 and 2 from the comment #42515 (comment) in #42515.
New settings for Block Formation Control
max_insert_block_size--max_insert_block_size_rowsmax_insert_block_size_byteswith which user can now control the formation of blocks in finer detailmin_insert_block_size_rowsandmin_insert_block_size_bytesto format parsing so that users can control the formation of blocks during parsing using lower bounds.What is covered
These settings now control block formation in Format parsing, when data is being parsed from row-based formats (CSV, TSV, JSONEachRow, etc.) and Values format via:
clickhouse-clientclickhouse-serverusing HTTP interfaceBlock Formation Logic
A block is emitted when either of these conditions is met:
min_insert_block_size_rowsANDmin_insert_block_size_bytesare reachedmax_insert_block_size_rowsORmax_insert_block_size_bytesis reachedDisabling settings: Set
max_insert_block_size_bytes,min_insert_block_size_rows, ormin_insert_block_size_bytesto0to disable. The setting will not participate in block formation decisions.Note:
max_insert_block_size_rowsshould remain non-zero still as it's used in other parts of code, for example in streaming engines.Limitations and future plans
Setting
max_insert_block_size_bytesis not supported in streaming engines (e.g.FileLog,Kafka,RabbitMQ,NATS), since there is no yetmax_block_size_bytessetting in these engines to override. Once it is clear how to add it, it will be possible to addmax_insert_block_sizeas a fallback setting.It is also planned to change the conditions for squashing, making not only
min_insert_block_size_rowsandmin_insert_block_size_bytesto be applied, but also add the formation of blocks usingmaxas an upper bound.Documentation entry for user-facing changes