[#6570] improvement(core): Optimize fetching entity parent id logic#6574
Merged
jerryshao merged 12 commits intoapache:mainfrom Mar 28, 2025
Merged
[#6570] improvement(core): Optimize fetching entity parent id logic#6574jerryshao merged 12 commits intoapache:mainfrom
jerryshao merged 12 commits intoapache:mainfrom
Conversation
Contributor
tengqm
reviewed
Mar 3, 2025
Contributor
tengqm
left a comment
There was a problem hiding this comment.
Overall looks good to me.
Left a suggestion regarding the several parallel if statements.
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java
Outdated
Show resolved
Hide resolved
Contributor
|
This is nice. |
Contributor
Author
|
@jerqi @jerryshao |
FourFriends
reviewed
Mar 18, 2025
| @Param("metalakeName") String metalakeName, @Param("catalogName") String catalogName) { | ||
| return "SELECT me.metalake_id as metalakeId, ca.catalog_id as catalogId FROM " | ||
| + TABLE_NAME | ||
| + " ca INNER JOIN metalake_meta me ON ca.metalake_id = me.metalake_id" |
Contributor
There was a problem hiding this comment.
We have confirmed that this join has no impact on internal usage at Xiaomi.
FourFriends
reviewed
Mar 18, 2025
| return "SELECT metalake_meta.metalake_id as metalakeId, catalog_meta.catalog_id as catalogId, " | ||
| + " schema_id as schemaId" | ||
| + " FROM metalake_meta" | ||
| + " JOIN catalog_meta ON metalake_meta.metalake_id = catalog_meta.metalake_id" |
Contributor
There was a problem hiding this comment.
We have confirmed that this join has no impact on internal usage at Xiaomi.
Contributor
Author
|
@jerqi @jerryshao |
jerryshao
reviewed
Mar 27, 2025
|
|
||
| public class CatalogIds { | ||
| private Long metalakeId; | ||
| private Long catalogId; |
Contributor
There was a problem hiding this comment.
Make these class variables final here and below.
Contributor
|
Generally LGTM, just some small comments. |
jerryshao
approved these changes
Mar 28, 2025
LindaSummer
pushed a commit
to LindaSummer/gravitino
that referenced
this pull request
Mar 30, 2025
…ogic (apache#6574) ### What changes were proposed in this pull request? Use `JOIN` to avoid fetching id several times when getting the parents of a fileset/table/topic/model ### Why are the changes needed? It's very time-consuming to retrieve id from database several times. Fix: apache#6570 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? Existing UTs
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.
What changes were proposed in this pull request?
Use
JOINto avoid fetching id several times when getting the parents of a fileset/table/topic/modelWhy are the changes needed?
It's very time-consuming to retrieve id from database several times.
Fix: #6570
Does this PR introduce any user-facing change?
N/A
How was this patch tested?
Existing UTs