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

Split AstToExecutor from dbgFuncCoprocessor. #4610

Merged
merged 11 commits into from
Apr 12, 2022

Conversation

ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented Apr 7, 2022

What problem does this PR solve?

Issue Number: ref #4609

Problem Summary:
Need to provide Ast to tipb::Executor helper functions for Interpreter test framework, but all of them are in .cpp file.

What is changed and how it works?

Move Ast to tipb::Executor helper functions to astToExecutor.h

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 7, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • SeaRise
  • yibin87

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 7, 2022
@ti-chi-bot
Copy link
Member

@ywqzzy: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ywqzzy ywqzzy changed the title Split AstToExecutor from dbgFuncCoprocessor. [DNM] Split AstToExecutor from dbgFuncCoprocessor. Apr 7, 2022
@ywqzzy ywqzzy changed the title [DNM] Split AstToExecutor from dbgFuncCoprocessor. Split AstToExecutor from dbgFuncCoprocessor. Apr 7, 2022
}
else if (ASTFunction * func = typeid_cast<ASTFunction *>(ast.get()))
{
/// aggregation function is handled in Aggregation, so just treated as a column
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 move this branch into another function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how about move this branch into another function?

Good idea. I will refactor them all.

}
else if (ASTFunction * func = typeid_cast<ASTFunction *>(ast.get()))
{
/// check function
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
} // namespace

String LOCAL_HOST = "127.0.0.1:3930";
Copy link
Contributor

Choose a reason for hiding this comment

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

move to anonymous namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. I have moved it into namespace db::debug.

}
virtual bool toTiPBExecutor(tipb::Executor * tipb_executor, uint32_t collator_id, const MPPInfo & mpp_info, const Context & context)
= 0;
virtual void toMPPSubPlan(size_t & executor_index, const DAGProperties & properties, std::unordered_map<String, std::pair<std::shared_ptr<ExchangeReceiver>, std::shared_ptr<ExchangeSender>>> & exchange_map)
Copy link
Contributor

Choose a reason for hiding this comment

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

is executor_index expected to be mutable to derived classes of Executor?

tipb::ExchangeType type;
TaskMetas task_metas;
std::vector<size_t> partition_keys;
ExchangeSender(size_t & index, const DAGSchema & output, tipb::ExchangeType type_, const std::vector<size_t> & partition_keys_ = {})
Copy link
Contributor

Choose a reason for hiding this comment

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

is index mutable?

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 is mutable

struct ExchangeReceiver : Executor
{
TaskMetas task_metas;
ExchangeReceiver(size_t & index, const DAGSchema & output)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

{
TableInfo table_info;
/// used by column pruner
TableScan(size_t & index_, const DAGSchema & output_schema_, TableInfo & table_info_)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, the same as table_info_.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

struct Selection : public Executor
{
std::vector<ASTPtr> conditions;
Selection(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> && conditions_)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Selection(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> && conditions_)
Selection(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> conditions_)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

{
std::vector<ASTPtr> order_columns;
size_t limit;
TopN(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> && order_columns_, size_t limit_)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TopN(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> && order_columns_, size_t limit_)
TopN(size_t & index_, const DAGSchema & output_schema_, std::vector<ASTPtr> order_columns_, size_t limit_)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2022
@pingcap pingcap deleted a comment from sre-bot Apr 7, 2022
@pingcap pingcap deleted a comment from sre-bot Apr 7, 2022
@pingcap pingcap deleted a comment from ti-chi-bot Apr 7, 2022
@pingcap pingcap deleted a comment from sre-bot Apr 7, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 7, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Apr 7, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MockExecutor.h                    521               310    40.50%          61                31    49.18%        1335               806    39.63%         502               303    39.64%
dbgFuncCoprocessor.cpp            406               326    19.70%          35                25    28.57%         833               676    18.85%         290               244    15.86%
dbgFuncCoprocessor.h                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             928               636    31.47%          97                56    42.27%        2169              1482    31.67%         792               547    30.93%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17020      9515             44.10%    191828  96449        49.72%

full coverage report (for internal network access only)

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 8, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Apr 8, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MockExecutor.cpp                  499               294    41.08%          44                20    54.55%        1309               788    39.80%         498               299    39.96%
MockExecutor.h                     22                16    27.27%          17                11    35.29%          26                18    30.77%           4                 4     0.00%
dbgFuncCoprocessor.cpp            406               326    19.70%          35                25    28.57%         833               676    18.85%         290               244    15.86%
dbgFuncCoprocessor.h                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             928               636    31.47%          97                56    42.27%        2169              1482    31.67%         792               547    30.93%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17020      9515             44.10%    191828  96430        49.73%

full coverage report (for internal network access only)

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 8, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Apr 8, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MockExecutor.cpp                  498               294    40.96%          44                20    54.55%        1305               791    39.39%         498               300    39.76%
MockExecutor.h                     29                19    34.48%          18                11    38.89%          44                25    43.18%          10                 8    20.00%
dbgFuncCoprocessor.cpp            406               326    19.70%          35                25    28.57%         833               676    18.85%         290               244    15.86%
dbgFuncCoprocessor.h                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             934               639    31.58%          98                56    42.86%        2183              1492    31.65%         798               552    30.83%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17020      9515             44.10%    191828  96448        49.72%

full coverage report (for internal network access only)

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 8, 2022

/run-integration-test

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 8, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 11, 2022

/cc @yibin87

@ti-chi-bot ti-chi-bot requested a review from yibin87 April 11, 2022 04:31
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 11, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Apr 11, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
astToExecutor.cpp                 500               294    41.20%          46                20    56.52%        1311               791    39.66%         498               300    39.76%
astToExecutor.h                    29                19    34.48%          18                11    38.89%          44                25    43.18%          10                 8    20.00%
dbgFuncCoprocessor.cpp            406               326    19.70%          35                25    28.57%         833               676    18.85%         290               244    15.86%
dbgFuncCoprocessor.h                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             936               639    31.73%         100                56    44.00%        2189              1492    31.84%         798               552    30.83%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17023      9510             44.13%    191899  96432        49.75%

full coverage report (for internal network access only)

Copy link
Contributor

@yibin87 yibin87 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 11, 2022
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

Others LGTM

{"group_concat", tipb::ExprType::GroupConcat},
});

DAGColumnInfo toNullableDAGColumnInfo(DAGColumnInfo & input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the parameter const?

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 12, 2022

/merge

@ti-chi-bot
Copy link
Member

@ywqzzy: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: f8a5692

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 12, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Apr 12, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
astToExecutor.cpp                 500               294    41.20%          46                20    56.52%        1311               791    39.66%         498               300    39.76%
astToExecutor.h                    29                19    34.48%          18                11    38.89%          44                25    43.18%          10                 8    20.00%
dbgFuncCoprocessor.cpp            406               326    19.70%          35                25    28.57%         833               676    18.85%         290               244    15.86%
dbgFuncCoprocessor.h                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             936               639    31.73%         100                56    44.00%        2189              1492    31.84%         798               552    30.83%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17023      9510             44.13%    191899  96429        49.75%

full coverage report (for internal network access only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants