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

[hotfix]Fix the incorrent paramater transmission of PageNum and PageSize #3343

Merged
merged 9 commits into from
Dec 23, 2024

Conversation

zhangwl9
Copy link
Contributor

Why are the changes needed?

Close #xxx.

Brief change log

We need to to transmit parameters of pageNum and pageSize in 'PageHelper#startPage' and the TableMetaMapper#selectTableRuntimesForOptimizerGroup,OptimizingMapper#selectOptimizingProcesses.

We correct the inconsistent problem.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@github-actions github-actions bot added the module:ams-server Ams server module label Nov 25, 2024
@zhangwl9 zhangwl9 changed the title [hotfix]Fix the incorrent paramater transmission in 'PageHelper#startPage' and the TableMetaMapper#selectTableRuntimesForOptimizerGroup,OptimizingMapper#selectOptimizingProcesses. [hotfix]Fix the incorrent paramater transmission in 'PageHelper#startPage' Nov 25, 2024
@zhangwl9 zhangwl9 changed the title [hotfix]Fix the incorrent paramater transmission in 'PageHelper#startPage' [hotfix]Fix the incorrent paramater transmission of PageNum and PageSize Nov 25, 2024
@zhangwl9
Copy link
Contributor Author

@klion26 @czy006 Could you please take a look at this when you're free, thanks

@klion26
Copy link
Member

klion26 commented Nov 25, 2024

@zhangwl9 thanks for the contribution, the change here LGTM.

As there was some ut want to cover the logic, so could you please help to check

  1. if the logic here in the master is right or not(if the code logic in the master branch can give the right result, maybe it is because the parameter in PageHelper.startPage(pageNumber, limit, true) -- line 517 has a higher priority than the parameter in the mapper)
  2. if the logic here in the master is wrong, could you please help to enhance the exist ut to cover the logic

Copy link
Contributor

@baiyangtx baiyangtx left a comment

Choose a reason for hiding this comment

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

After introducing github.PageHelper, do we still need to pass the pageNumber and limit parameters to the mapper?

It seems that these two parameters are not required in the process of constructing SQL.

@Aireed Aireed added this to the Release 0.8.0 milestone Dec 4, 2024
@Aireed Aireed mentioned this pull request Dec 4, 2024
33 tasks
…and pageSize in 'PageHelper#startPage' and the TableMetaMapper#selectTableRuntimesForOptimizerGroup,OptimizingMapper#selectOptimizingProcesses
@zhangwl9 zhangwl9 force-pushed the AMORO-FixBug-in-PageHelper branch from 489f3e4 to 8fe4573 Compare December 6, 2024 08:55
@zhangwl9
Copy link
Contributor Author

zhangwl9 commented Dec 6, 2024

@zhangwl9 thanks for the contribution, the change here LGTM.

As there was some ut want to cover the logic, so could you please help to check

  1. if the logic here in the master is right or not(if the code logic in the master branch can give the right result, maybe it is because the parameter in PageHelper.startPage(pageNumber, limit, true) -- line 517 has a higher priority than the parameter in the mapper)
  2. if the logic here in the master is wrong, could you please help to enhance the exist ut to cover the logic

@klion26 Thank you very much for your advice. I have tested and found the following:

  1. The parameter (pageNumber,limit) in PageHelper.startPage(pageNumber, limit, true) -- line 517 has a higher priority than the parameter(pageNum, pageSize) in the mapper, as shown in figure
    image

  2. When building the mapper's SQL statement, if the parameters pageNum and pageSize are removed, amoro displays normally, as shown in the figure.
    image

Therefore, pageNum and pageSize are not needed during SQL construction. I have already fixed it.

  1. Two unit tests involving mappers: TestIcebergServerTableDescriptor#testOptimizingPorcess and TestDefaultOptimizingService#testGetRuntimes can both cover the results of PageHelper and PageInfo, therefore, no new unit tests need to be added.

@zhangwl9
Copy link
Contributor Author

zhangwl9 commented Dec 6, 2024

After introducing github.PageHelper, do we still need to pass the pageNumber and limit parameters to the mapper?

It seems that these two parameters are not required in the process of constructing SQL.
@baiyangtx Thank you very much for your advice. You are right. I have fix it.

Copy link
Member

@klion26 klion26 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, LGTM

@klion26
Copy link
Member

klion26 commented Dec 13, 2024

@zhangwl9 Seems there are some tests failed, could you please help to check it, thanks.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.48%. Comparing base (243d289) to head (324f009).
Report is 15 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3343      +/-   ##
============================================
+ Coverage     21.59%   27.48%   +5.89%     
- Complexity     2309     3511    +1202     
============================================
  Files           426      593     +167     
  Lines         39719    48303    +8584     
  Branches       5624     6233     +609     
============================================
+ Hits           8577    13278    +4701     
- Misses        30414    34092    +3678     
- Partials        728      933     +205     
Flag Coverage Δ
core 27.48% <ø> (?)
trino ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@czy006 czy006 left a comment

Choose a reason for hiding this comment

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

LGTM

@czy006 czy006 merged commit 893ae22 into apache:master Dec 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-server Ams server module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants