risingwavelabs / risingwave

Best-in-class stream processing, analytics, and management. Perform continuous analytics, or build event-driven applications, real-time ETL pipelines, and feature stores in minutes. Unified streaming and batch. PostgreSQL compatible.
https://go.risingwave.com/slack
Apache License 2.0
7.04k stars 579 forks source link

sqlsmith: sql reducer #7504

Open kwannoel opened 1 year ago

kwannoel commented 1 year ago

Usecase

Generated queries can get rather nested and complex. This means they have to be shrunk in order to pinpoint the root cause of bugs.

Rough steps of manual sql reducing, starting with innermost subqueries:

As you can see the steps are fairly mechanical, and can be automated.

We can either find an existing implementation, or implement a barebones version ourselves, if it's not too much effort.

Usage

  1. Input failing ddl + sql query and phase.
  2. output shrunk query after 1 shrinking step. Output must be valid sql.

Existing implementations

kwannoel commented 1 year ago

Not a high priority, since sqlsmith work is wrapping up, and many bugs are already caught and fixed. But I think it could be interesting to implement one, and still moderately useful, as new features are added to RW and tested in sqlsmith.

Creating an issue in case someone is interested in it.

xxchan commented 1 year ago

May refer to how QuickCheck shrinks 😄

kwannoel commented 1 year ago

@jon-chuang

jon-chuang commented 1 year ago

output shrunk query after 1 shrinking step. Output must be valid sql.

Let's speculatively try to remove instead of just 1 step. We should speculatively remove things until removing something will no longer produce the panic.

xxchan commented 1 year ago

I found actually I have played with this idea very long time ago, but not sure whether it works. 🥵 Just post it here for reference: https://github.com/risingwavelabs/risingwave/compare/main...xxchan/shrink

github-actions[bot] commented 1 year ago

This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned.