Skip to content

repeat_row: Add random-generated tests#36192

Draft
ggevay wants to merge 5 commits intoMaterializeInc:mainfrom
ggevay:repeat_row-7-random-query-tests
Draft

repeat_row: Add random-generated tests#36192
ggevay wants to merge 5 commits intoMaterializeInc:mainfrom
ggevay:repeat_row-7-random-query-tests

Conversation

@ggevay
Copy link
Copy Markdown
Contributor

@ggevay ggevay commented Apr 21, 2026

Draft

Resolves SQL-166

ggevay and others added 5 commits April 21, 2026 21:14
… ignores

Introduces `Scenario.RepeatRow` and a new central module
`negative_accumulation_errors.py` holding the substrings of error
messages Materialize produces when it detects a negative accumulation
(or similar "non-positive multiplicity" condition). The list is sourced
from database-issues#9308; when the messages are reworded we update
this file and Parallel Workload picks up the changes.

When the new scenario is active, these substrings are added to the
baseline `Action.errors_to_ignore`, covering every action that inherits
that method (DDL and read-path alike). No queries involving
`repeat_row` are generated yet; that arrives in follow-up commits.

Co-authored-by: Junie <junie@jetbrains.com>
Turns on the `enable_repeat_row` system parameter so the new
`Scenario.RepeatRow` can actually call `repeat_row`. The function is
not generated in any other scenario, so this flip is a no-op for the
existing Parallel Workload runs.

Co-authored-by: Junie <junie@jetbrains.com>
In the new `RepeatRow` scenario, ~5% of newly created views wrap their
body as `SELECT * FROM (<original>) AS rr_inner, repeat_row(-1)`. The
`-1` is constant-folded into a `Constant` MIR node with negative diffs,
exercising operator code paths that must handle negative multiplicities
without panicking.

The `-1` is hardcoded (rather than picking a random small negative) to
avoid blowing up the data size. The matching ignore list for
negative-accumulation errors was wired up in a previous commit.

Co-authored-by: Junie <junie@jetbrains.com>
In the `RepeatRow` scenario, bootstrap a hardcoded `repeat_row_source`
table with a fixed mix of `+1`, `-1`, and `0` values, and have ~5% of
views use a hardcoded body of
  SELECT r.diff::bigint AS <col> FROM repeat_row_source r,
      repeat_row(r.diff)
This exercises the runtime path where the `repeat_row` count is not
constant-folded but read from a column, which can take negative values.

The two `repeat_row` view modes (constant and table-driven) are mutually
exclusive. The matching error ignores were already wired up.

Co-authored-by: Junie <junie@jetbrains.com>
Templated on `parallel-workload-rename`: same agent queue, runtime, and
thread count, but passes `--scenario=repeat-row` to enable the new
`repeat_row` codegen and the matching negative-accumulation error
ignores. Other Parallel Workload steps are unaffected (the `RepeatRow`
scenario is the only place that generates `repeat_row` queries).

Co-authored-by: Junie <junie@jetbrains.com>
@ggevay ggevay added the T-testing Theme: tests or test infrastructure label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-testing Theme: tests or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant