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

[CBRD-24606] refactoring pr_midxkey_compare() #4025

Merged

Conversation

ctshim
Copy link
Contributor

@ctshim ctshim commented Jan 4, 2023

http://jira.cubrid.org/browse/CBRD-24606

  • Removes meaningless code lines.
  • Try to perform fewer comparisons of if() statements.
  • The code was simplified by reducing the components of the function.
     

@ctshim ctshim self-assigned this Jan 4, 2023
Comment on lines 7858 to 7859
adv_size = pr_midxkey_element_disk_size (mem1, dom1);
mem1 += adv_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about below?

Suggested change
adv_size = pr_midxkey_element_disk_size (mem1, dom1);
mem1 += adv_size;
mem1 += pr_midxkey_element_disk_size (mem1, dom1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought Optimizer would take care of that.
I thought it would be nice to have a variable to put the value in for debugging in case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Thank you.

@ctshim ctshim requested a review from youngjinj January 5, 2023 06:38
Comment on lines +18855 to 18858
if (dom_is_desc[0])
{
c = ((c == DB_GT) ? DB_LT : (c == DB_LT) ? DB_GT : c);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be handled inside pr_midxkey_compare?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's possible, but it's not appropriate because you need to add an agreement.

Copy link
Contributor

Choose a reason for hiding this comment

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

I found out that this part should not be included because pr_midxkey_compare() is not used only for index sorting.

@ctshim ctshim merged commit 5aba6b1 into CUBRID:develop Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants