-
Notifications
You must be signed in to change notification settings - Fork 771
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
refactor: use BlocksSerializer
to replace StringBlock
to simplify the serialization
#17667
Open
KKould
wants to merge
5
commits into
databendlabs:main
Choose a base branch
from
KKould:perf/eliminate_string_block
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+426
−240
Conversation
This file contains 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
to replace
StringBlock` to simplify the serialization to replace
StringBlock` to simplify the serialization
… serialization Signed-off-by: Kould <[email protected]>
51bdc5e
to
7e83c17
Compare
b41sh
reviewed
Mar 28, 2025
1e09ad5
to
69edfa2
Compare
Signed-off-by: Kould <[email protected]>
69edfa2
to
637d083
Compare
Maybe we need to add a new |
to replace
StringBlock` to simplify the serializationBlocksSerializer
to replace StringBlock
to simplify the serialization
Signed-off-by: Kould <[email protected]>
youngsofun
reviewed
Mar 29, 2025
src/query/service/src/servers/http/v1/query/blocks_serializer.rs
Outdated
Show resolved
Hide resolved
youngsofun
reviewed
Mar 29, 2025
youngsofun
approved these changes
Mar 29, 2025
Signed-off-by: Kould <[email protected]>
Signed-off-by: Kould <[email protected]>
sundy-li
approved these changes
Mar 31, 2025
b41sh
approved these changes
Mar 31, 2025
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.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
StringBlock
in HTTP Server Data Serialization #17662when using
StringBlocks
to query large amounts of data, data was frequently materialized and there were meaningless data conversions. For example, the String type was first converted to Bytes and then to String.This PR uses
BlocksSerializer
to collectDataBlocks
that need to be serialized. When serde serialization is performed, it will imitate the behavior of Vec for serialization, thus avoiding the need forDataBlock
to be converted to string line by line in the originalStringBlock
and then collected asVec<Vec<Option<String>>>
When extracting data from a
DataBlock
,BlocksSerializer
will try to directly extract data from String, Variant, and other types that are Strings, avoiding the meaningless conversion to Bytes in the middle.Originally, when processing
remaining_size
andremaining_rows
, the specific size of the data is calculated row by row. However, when the amount of data is large, this will take up some overhead. Therefore, this PR uses theProportional Splitting
. Assuming that the data in DataBlock is uniform,take_rows = (remain_size * block_rows) / block_size
is used to determine how many rows of data can be obtained under theremaining_size
limit, and then further limit it throughremaining_row
.test case:
Release Mode:
after.pb.gz
before.pb.gz
Tests
test_max_size_per_page
&test_max_size_per_page_total_rows
Type of change
This change is