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

opt: validate logical properties during execution tests #30013

Open
justinj opened this issue Sep 10, 2018 · 5 comments
Open

opt: validate logical properties during execution tests #30013

justinj opened this issue Sep 10, 2018 · 5 comments
Labels
A-sql-optimizer SQL logical planning and optimizations. A-testing Testing tools and infrastructure C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team

Comments

@justinj
Copy link
Contributor

justinj commented Sep 10, 2018

The logical properties of a relational expression are basically statements of facts about that expression - it would be valuable for us to validate that those statements are accurate. One way to do this might be to add an extra operator on top of every operator that just passes through its rows and also errors of one of the various logical properties are violated.

Jira issue: CRDB-4850

@justinj justinj added A-sql-optimizer SQL logical planning and optimizations. A-testing Testing tools and infrastructure labels Sep 10, 2018
@justinj justinj self-assigned this Sep 10, 2018
@knz knz added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Sep 21, 2018
@knz knz added this to To do in BACKLOG, NO NEW ISSUES: SQL Optimizer via automation Sep 21, 2018
@andy-kimball
Copy link
Contributor

@justinj, how does this differ from what we do today in checkExpr (which we run on -race builds)?

@justinj
Copy link
Contributor Author

justinj commented Oct 3, 2018

@andy-kimball this would actually occur during execution, rather than planning, and would verify that the assertions made by logical props are actually true in practice. I recall @RaduBerinde and I both independently tried some of this and didn't find anything, though

@RaduBerinde
Copy link
Member

What I tried is in this branch: RaduBerinde@8cba3bb
It's a planNode that checks not-null columns and cardinality (with a planNode). We wrap every node int he plan with one of these. Didn't find anything in the logictests or bigtesst. Next step would be to validate FDs (at least on a sampling of the rows).

@andy-kimball andy-kimball moved this from To do to Higher Priority Backlog in BACKLOG, NO NEW ISSUES: SQL Optimizer Feb 7, 2019
@RaduBerinde RaduBerinde self-assigned this Jan 24, 2020
@RaduBerinde
Copy link
Member

RaduBerinde commented Jan 24, 2020

This would be very valuable to test FDs. We could set up tests like this:

  • come up with a bunch of test table schemas
  • for each table, fill up the table in the following way: generate all possible combinations for all the columns with values from a small set, e.g. (NULL, 1, 2, 3). Randomize the rows and insert them one by one, ignoring errors.
  • run various queries on the table (e.g. with random filters) with the assertions enabled

@RaduBerinde RaduBerinde moved this from Higher Priority Backlog to Infrastructure & performance in BACKLOG, NO NEW ISSUES: SQL Optimizer Apr 18, 2020
@jlinder jlinder added the T-sql-queries SQL Queries Team label Jun 16, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
BACKLOG, NO NEW ISSUES: SQL Optimizer automation moved this from Infrastructure & performance to Done Oct 2, 2023
@yuzefovich yuzefovich reopened this May 2, 2024
BACKLOG, NO NEW ISSUES: SQL Optimizer automation moved this from Done to Triage May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-optimizer SQL logical planning and optimizations. A-testing Testing tools and infrastructure C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects
Status: Backlog
Development

No branches or pull requests

6 participants