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

test: introduce planner and optimizer test #593

Closed
Tracked by #572
skyzh opened this issue Mar 29, 2022 · 3 comments
Closed
Tracked by #572

test: introduce planner and optimizer test #593

skyzh opened this issue Mar 29, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@skyzh
Copy link
Member

skyzh commented Mar 29, 2022

For database developers, query plans are important -- whether a change in optimizer will bring unexpected result? how is a query being processed currently? is every optimization rule work as expected?

To help visualize the result of optimizer, I propose to have a planner test framework in RisingLight.

Planner test will be defined with yaml files in the following format:

- sql: |
    /* TPC-H Q6 */ 
    create table lineitem(...);
    select
      sum(l_extendedprice * l_discount) as revenue
    from
      lineitem
    where
      l_shipdate >= date '1994-01-01'
      and l_shipdate < date '1905-01-01'
      and l_discount between 0.08 - 0.01 and 0.08 + 0.01
      and l_quantity < 24;
  logical_plan: |
    <the logical plan>
  physical_plan: |
    <the batch plan>

For each item in the yaml file, there will be a sequence of SQL statements, where the last statement will be used to do plan test. We will serialize logical plan the physical plan into the yaml, commit them into the git repo, and test if the current optimizer generates the same plan as test cases, so that we can easily compare the changes before and after a PR.

Our plan nodes already supports serialization with serde_erased, so serialization should be easy.

At the same time, we'd better also have a utility command to update the result of all plan test cases, like cargo run --bin apply-planner-test.

@skyzh skyzh mentioned this issue Mar 29, 2022
18 tasks
@likg227
Copy link
Contributor

likg227 commented Mar 30, 2022

It's very similar to RisingWave's planner test framework, we can port it to RisingLight after RisingWave open source.

@skyzh
Copy link
Member Author

skyzh commented Apr 10, 2022

So it's time to port https://github.com/singularity-data/risingwave/tree/main/src/frontend/test_runner to RisingLight 🤣

@skyzh skyzh added the enhancement New feature or request label Apr 28, 2022
@skyzh skyzh self-assigned this Jun 7, 2022
@skyzh
Copy link
Member Author

skyzh commented Jun 14, 2022

fixed by #661

@skyzh skyzh closed this as completed Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants