Normalize schema fingerprint for column permutations#17044
Merged
abhishekagarwal87 merged 7 commits intoapache:masterfrom Sep 18, 2024
Merged
Normalize schema fingerprint for column permutations#17044abhishekagarwal87 merged 7 commits intoapache:masterfrom
abhishekagarwal87 merged 7 commits intoapache:masterfrom
Conversation
added 3 commits
September 12, 2024 20:03
…se for different column permutations
cryptoe
approved these changes
Sep 16, 2024
| // thus avoiding schema explosion in the metadata database | ||
| // Note that this signature is not persisted anywhere, it is only used for fingerprint computation | ||
| final RowSignature sortedSignature = getLexicographicallySortedSignature(schemaPayload.getRowSignature()); | ||
| final SchemaPayload updatedPayload = new SchemaPayload(sortedSignature, schemaPayload.getAggregatorFactories()); |
Contributor
There was a problem hiding this comment.
Please mention a note about the aggregator factories as well that they are column order independent since they are backed by a map.
added 4 commits
September 17, 2024 10:29
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.
Parent issue: #14989
It is possible for the order of columns to vary across segments especially during realtime ingestion.
Since, the schema fingerprint is sensitive to column order this leads to creation of a large number of segment schema in the metadata database for essentially the same set of columns.
This is wasteful, this patch fixes this problem by computing schema fingerprint on lexicographically sorted columns. This would result in creation of a single schema in the metadata database with the first observed column order for a given signature.
Release notes
In the CentralizedDatasourceSchema feature, different permutations of the same column order do not result in distinct schemas in the database.