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

bug(tianmu):improve the code quality and refactoring derived table optimize for tianmu(#1277, #1276, #1258) #1281

Merged
merged 2 commits into from
Feb 16, 2023

Conversation

isredstar
Copy link
Collaborator

Summary about this PR

Issue Number: close #1247,#1276,#1258
refactor derived table optimize for tianmu
improve the code quality to modify the magic number

Tests Check List

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Changelog

  • New Feature
  • Bug Fix
  • Performance Improvement
  • Build/Testing/CI/CD
  • Documentation
  • Not for changelog (changelog entry is not required)

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features

@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2023

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the PR-feature feature for pull request label Feb 7, 2023
@isredstar isredstar self-assigned this Feb 7, 2023
@isredstar isredstar added this to the stonedb_5.7_v1.0.3 milestone Feb 7, 2023
@isredstar isredstar changed the title feat(tianmu):improve the code quality and refactoring derived table optimize for tianmu(#1277, #1276, #1258) bug:improve the code quality and refactoring derived table optimize for tianmu(#1277, #1276, #1258) Feb 7, 2023
@isredstar isredstar added A-bug Something isn't working and removed PR-feature feature for pull request labels Feb 7, 2023
@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2023

This pull request's title should follow requirements next. @isredstar please check it 👇.

Valid format:

fix(vc): fix sth..... (#3306)
  ^         ^---------^  ^----^
  |         |            |
  |         +            +-> you issue id.
  |         |
  |         +-> Summary in present tense.
  |
  +-------> Type: feat, fix, docs, workflow, style, refactor, test, website, chore

Valid types:

  • feat: new feature for stonedb
  • fix: bug fix for stonedb
  • docs: changes to the documentation
  • workflow: ci/cd in .github
  • perf: Changes to improve code performance
  • refactor: refactoring production code, eg. renaming a variable
  • style: formatting, missing semi colons, etc; no production code change
  • test: adding missing tests, refactoring tests; no production code change
  • website
  • chore: updating grunt tasks etc; no production code change

@isredstar isredstar changed the title bug:improve the code quality and refactoring derived table optimize for tianmu(#1277, #1276, #1258) bug(tianmu):improve the code quality and refactoring derived table optimize for tianmu(#1277, #1276, #1258) Feb 7, 2023
@isredstar isredstar force-pushed the stonedb-5.7-dev branch 2 times, most recently from 3e93dce to 7341a45 Compare February 8, 2023 02:27
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Base: 0.00% // Head: 43.10% // Increases project coverage by +43.10% 🎉

Coverage data is based on head (3ef25d4) compared to base (fa5917a).
Patch coverage: 80.42% of modified lines in pull request are covered.

❗ Current head 3ef25d4 differs from pull request most recent head f62e2e9. Consider uploading reports for the commit f62e2e9 to get more accurate results

Additional details and impacted files
@@                 Coverage Diff                  @@
##           stonedb-5.7-dev    #1281       +/-   ##
====================================================
+ Coverage                 0   43.10%   +43.10%     
====================================================
  Files                    0     1830     +1830     
  Lines                    0   396311   +396311     
====================================================
+ Hits                     0   170839   +170839     
- Misses                   0   225472   +225472     
Impacted Files Coverage Δ
sql/sql_derived.cc 95.89% <ø> (ø)
sql/sql_lex.h 53.06% <ø> (ø)
sql/sql_optimizer.h 74.54% <ø> (ø)
sql/sql_select.h 73.27% <ø> (ø)
sql/table.h 55.00% <ø> (ø)
storage/tianmu/core/engine.h 30.43% <ø> (ø)
storage/tianmu/core/engine_execute.cpp 58.46% <75.43%> (ø)
sql/sql_optimizer.cc 68.73% <81.60%> (ø)
sql/sql_parse.cc 61.84% <100.00%> (ø)
sql/sql_select.cc 69.41% <100.00%> (ø)
... and 1832 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@isredstar isredstar added PR-bug bug for pull request and removed A-bug Something isn't working labels Feb 9, 2023
Copy link

@lujiashun lujiashun left a comment

Choose a reason for hiding this comment

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

suggest to refer to this script to format your code.( you should have installed clang-format, clang-format-diff.py)

#/bin/bash
echo $0
cd ..
cur=`pwd`"/"
cd  storage/tianmu
echo $cur
git status .|grep modified |awk '{print $2}'|xargs -i -n 1 clang-format  --style=file -i {}
git diff HEAD -U0 --no-color --src-prefix=$cur --dst-prefix=$cur | clang-format-diff.py -i -style=file

including those in semi-joins.
*/
if (select_lex->materialized_derived_table_count)
{

Choose a reason for hiding this comment

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

blank space number was more than expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ACK

sql/sql_optimizer.cc Show resolved Hide resolved
@@ -55,6 +55,15 @@ typedef struct st_rollup
List<Item> *fields;
} ROLLUP;

enum class OptimizePhase // for Tianmu to indicate which optimization phase.

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ACK

@@ -10444,14 +10435,14 @@ static bool internal_remove_eq_conds(THD *thd, Item *cond,
}
if (cond->const_item())
{
if (part!=1 || cond->type()!=Item::SUBSELECT_ITEM)
{//TIANMU UPGRADE
if (phase !=OptimizePhase::Before_LOJ_Transform || cond->type()!=Item::SUBSELECT_ITEM)

Choose a reason for hiding this comment

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

add a blank space after '!="

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ACK

sql/sql_lex.h Outdated
int optimize_for_tianmu();
int optimize_after_tianmu();
//END
int after_optimize_tianmu();
Copy link
Collaborator

Choose a reason for hiding this comment

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

why rename the function name? what's the difference?

Copy link
Collaborator Author

@isredstar isredstar Feb 14, 2023

Choose a reason for hiding this comment

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

The optimize_after_tianmu has been as a variable name,so I think it is not suitable as a function name.

Copy link
Collaborator

Choose a reason for hiding this comment

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

a function name should start with a verb. like set_value, update_row, I suggest rename the variable name.

@isredstar isredstar force-pushed the stonedb-5.7-dev branch 5 times, most recently from a8637fe to 3bf8723 Compare February 15, 2023 10:20
@isredstar isredstar force-pushed the stonedb-5.7-dev branch 3 times, most recently from c04a28b to 64fc98c Compare February 15, 2023 12:59
Copy link

@lujiashun lujiashun left a comment

Choose a reason for hiding this comment

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

LGTM

@mergify mergify bot merged commit bdbf8d9 into stoneatom:stonedb-5.7-dev Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-bug bug for pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants