Skip to content

Test: Mock window function, refactor window function tests#5021

Merged
ti-chi-bot merged 44 commits intopingcap:masterfrom
ywqdev:mock_window_function
Jun 13, 2022
Merged

Test: Mock window function, refactor window function tests#5021
ti-chi-bot merged 44 commits intopingcap:masterfrom
ywqdev:mock_window_function

Conversation

@ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented May 27, 2022

What problem does this PR solve?

Issue Number: ref #4609 close #5081

Problem Summary:
Mock window and sort executors.
Rewrite window function tests in new test framework.

What is changed and how it works?

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 May 27, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Lloyd-Pottiger
  • SeaRise

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.

Details

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 27, 2022
@Lloyd-Pottiger
Copy link
Contributor

you can try gmock to do mock test which has embedded in gtest

@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 30, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented May 30, 2022

you can try gmock to do mock test which has embedded in gtest

It's not my intention to this pr.
But great idea, I will feature out a way to mock data using gmock for future.

@ywqzzy ywqzzy changed the title [WIP]Interpreter: Mock window function Interpreter: Mock window function Jun 1, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 1, 2022
@ywqzzy ywqzzy requested a review from SeaRise June 1, 2022 03:42
@SeaRise
Copy link
Contributor

SeaRise commented Jun 10, 2022

maybe we can remove #ifndef DBMS_PUBLIC_GTEST in

#ifndef DBMS_PUBLIC_GTEST
private:
#endif
and
#ifndef DBMS_PUBLIC_GTEST
private:
#endif

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 10, 2022
window_description.window_functions_descriptions.begin(),
window_description.window_functions_descriptions.end(),
[&](const auto & func, FmtBuffer & b) {
b.fmtAppend("{}", func.window_function->getName());
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
b.fmtAppend("{}", func.window_function->getName());
b.append(func.window_function->getName());

@ywqzzy ywqzzy requested a review from Lloyd-Pottiger June 13, 2022 04:34
Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger 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 Jun 13, 2022
@ywqzzy
Copy link
Contributor Author

ywqzzy commented Jun 13, 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.

Details

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.

DetailsCommit hash: 958722d

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

sre-bot commented Jun 13, 2022

Coverage for changed files

Filename                                             Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DataStreams/WindowBlockInputStream.cpp                   162                34    79.01%          20                 0   100.00%         397                96    75.82%         124                33    73.39%
DataStreams/WindowBlockInputStream.h                      26                 2    92.31%          15                 2    86.67%          58                15    74.14%          16                 2    87.50%
Debug/astToExecutor.cpp                                  576               215    62.67%          53                 9    83.02%        1516               553    63.52%         568               254    55.28%
Debug/astToExecutor.h                                     33                12    63.64%          22                 7    68.18%          50                18    64.00%          10                 6    40.00%
Flash/Coprocessor/DAGExpressionAnalyzer.h                  2                 1    50.00%           2                 1    50.00%           2                 1    50.00%           0                 0         -
Flash/Coprocessor/DAGQueryBlockInterpreter.h               2                 0   100.00%           2                 0   100.00%           2                 0   100.00%           0                 0         -
Flash/Coprocessor/DAGUtils.cpp                           347               155    55.33%          45                15    66.67%         638               294    53.92%         412               197    52.18%
Flash/Coprocessor/collectOutputFieldTypes.cpp             59                 8    86.44%          14                 0   100.00%         143                21    85.31%          56                11    80.36%
Flash/tests/gtest_interpreter.cpp                        110                57    48.18%           4                 0   100.00%         415                 0   100.00%          12                12     0.00%
Interpreters/WindowDescription.cpp                        23                11    52.17%           5                 0   100.00%          63                24    61.90%          28                11    60.71%
Interpreters/WindowDescription.h                           1                 1     0.00%           1                 1     0.00%          11                11     0.00%           0                 0         -
TestUtils/ExecutorTestUtils.cpp                           69                 8    88.41%          12                 1    91.67%         101                 5    95.05%          26                 6    76.92%
TestUtils/ExecutorTestUtils.h                              6                 2    66.67%           3                 0   100.00%          18                 6    66.67%           6                 3    50.00%
TestUtils/FunctionTestUtils.cpp                          138                23    83.33%          14                 0   100.00%         155                19    87.74%          62                21    66.13%
TestUtils/FunctionTestUtils.h                            116                 9    92.24%          36                 0   100.00%         273                 7    97.44%          48                 6    87.50%
TestUtils/executorSerializer.cpp                          71                 8    88.73%          29                 1    96.55%         360                31    91.39%          50                10    80.00%
TestUtils/mockExecutor.cpp                                79                15    81.01%          49                12    75.51%         307                63    79.48%          36                 3    91.67%
TestUtils/mockExecutor.h                                   6                 1    83.33%           6                 1    83.33%          15                 3    80.00%           0                 0         -
TestUtils/tests/gtest_mock_executors.cpp                 262               190    27.48%          11                 0   100.00%         215                 0   100.00%          40                40     0.00%
WindowFunctions/tests/gtest_window_functions.cpp          30                19    36.67%           2                 0   100.00%         143                 0   100.00%           4                 4     0.00%
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                   2118               771    63.60%         345                50    85.51%        4882              1167    76.10%        1498               619    58.68%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18322      9640             47.39%    205718  96567        53.06%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit f4c2e01 into pingcap:master Jun 13, 2022
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.

Unit test failed when run function related test with Interpreter Tests.

6 participants