Skip to content
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

[#6570] improvement(core): Optimize fetching entity parent id logic #6574

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

yuqi1129
Copy link
Contributor

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: #6570

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

Existing UTs

@jerqi
Copy link
Contributor

jerqi commented Feb 28, 2025

@lw-yang

Copy link
Contributor

@tengqm tengqm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me.
Left a suggestion regarding the several parallel if statements.

Long parentEntityId = null;
if (namespace.levels().length >= 1) {
if (namespace.levels().length == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can get the optimization logic here.
Can we further revise this logic into a switch...case for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

@yuqi1129 yuqi1129 closed this Mar 3, 2025
@yuqi1129 yuqi1129 reopened this Mar 3, 2025
@yuqi1129 yuqi1129 self-assigned this Mar 3, 2025
@tengqm
Copy link
Contributor

tengqm commented Mar 4, 2025

This is nice.

@yuqi1129 yuqi1129 closed this Mar 5, 2025
@yuqi1129 yuqi1129 reopened this Mar 5, 2025
@yuqi1129 yuqi1129 requested review from tengqm and jerryshao and removed request for tengqm March 8, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants