Skip to content

repeat_row: Fix SingleTimeMonotonic to take into account FlatMap's TableFunc's preserves_monotonicity#36183

Open
ggevay wants to merge 5 commits intoMaterializeInc:mainfrom
ggevay:repeat_row-2-SingleTimeMonotonic
Open

repeat_row: Fix SingleTimeMonotonic to take into account FlatMap's TableFunc's preserves_monotonicity#36183
ggevay wants to merge 5 commits intoMaterializeInc:mainfrom
ggevay:repeat_row-2-SingleTimeMonotonic

Conversation

@ggevay
Copy link
Copy Markdown
Contributor

@ggevay ggevay commented Apr 21, 2026

This is the 2. PR in the repeat_row productionization work stream. This is on top of #36174. Resolves SQL-162.

Fixes a part of https://github.com/MaterializeInc/database-issues/issues/11310, namely that RelaxMustConsolidate/SingleTimeMonotonic was not taking into account table functions' preserves_monotonicity. (can only happen repeat_row currently)

Only the last 2 commits are new:

  1. adds a test that shows a wrong plan
  2. fixes the bug and rewrites the test output, adding the missing must_consolidate.

(Will shortly submit a PR also about fixing refine_single_time_operator_selection, because the monotonic flag on the Reduce is also wrong in this same plan. That's a slightly more involved fix, so I'd like to put that into a separate PR.)

ggevay added 4 commits April 21, 2026 11:11
Also disallow it in constructs that are implemented by WITH ORDINALITY
under the hood:
- ROWS FROM
- implicit ROWS FROM, i.e., multiple table functions in a SELECT clause
@ggevay ggevay requested review from a team as code owners April 21, 2026 13:10
@ggevay ggevay requested a review from aljoscha April 21, 2026 13:10
@ggevay ggevay added T-correctness Theme: relates to consistency and correctness of results. A-optimization Area: query optimization and transformation labels Apr 21, 2026
@ggevay ggevay changed the title Fix SingleTimeMonotonic to take into account FlatMap's TableFunc's preserves_monotonicity repeat_row: Fix SingleTimeMonotonic to take into account FlatMap's TableFunc's preserves_monotonicity Apr 21, 2026
@ggevay ggevay added the A-CLUSTER Topics related to the CLUSTER layer label Apr 21, 2026
@ggevay ggevay force-pushed the repeat_row-2-SingleTimeMonotonic branch from 07f247c to bacc017 Compare April 23, 2026 11:19
@ggevay ggevay force-pushed the repeat_row-2-SingleTimeMonotonic branch from bacc017 to 7493b4c Compare April 23, 2026 11:22
@ggevay ggevay removed request for a team and aljoscha April 23, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLUSTER Topics related to the CLUSTER layer A-optimization Area: query optimization and transformation T-correctness Theme: relates to consistency and correctness of results.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant