Skip to content

Compact dateAggregationCtes - #4092

Merged
awildturtok merged 7 commits into
developfrom
feature/move-row-numbering-to-preprocessing-cte
Nov 24, 2026
Merged

awildturtok merged 7 commits into
developfrom
feature/move-row-numbering-to-preprocessing-cte

Conversation

@awildturtok

Copy link
Copy Markdown
Collaborator

Reduces overhead on joins

@awildturtok
awildturtok requested a review from thoniTUB as a code owner October 20, 2026 09:33
@awildturtok
awildturtok changed the base branch from develop to feature/complete-sql-selects October 20, 2026 09:34
@awildturtok
awildturtok added this pull request to stack #4093 October 20, 2026 09:34
@awildturtok
awildturtok force-pushed the feature/move-row-numbering-to-preprocessing-cte branch from ca48756 to 48bbe0c Compare October 20, 2026 09:43
@awildturtok
awildturtok force-pushed the feature/move-row-numbering-to-preprocessing-cte branch 3 times, most recently from fcddafc to 15ec35c Compare October 26, 2026 10:14
@awildturtok
awildturtok removed this pull request from stack #4093 November 4, 2026 12:49
@awildturtok
awildturtok added this pull request to stack #4127 November 4, 2026 13:13

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gehört das in den PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc hat das rumschieben der ctes hier was gemacht, weiß es aber tbh nicht mehr

Comment on lines +95 to +101
Condition startIsNull = allStarts.stream()
.map(Field::isNull)
.reduce(Condition::or)
.orElseThrow();
Condition startBeforeEnd = this.functionProvider.greatest(allStarts).lessThan(this.functionProvider.least(allEnds));
Condition noOverlapCondition = startIsNull.orNot(startBeforeEnd);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da die methoden ahnlich sind: -> MergeCte.noOverlapCondition

import org.jooq.Field;

@Getter
class IntermediateTableCte extends DateAggregationCte {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bitte doku ergänzen, weshalb es diese intermediate table benötigt wird. Aus sql_date_aggregation.md verstehe ich, dass sie für die no_overlap cte im merge modus gebraucht wird. Aber für etwas anderes wird sie nicht gebraucht oder?

context.getCarryThroughSelects()
)
.flatMap(Collection::stream)
.collect(Collectors.toList());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier weiter unten ist ein Pattern das sich mehrere male wiederholt:

		SqlFunctionProvider functionProvider = context.getFunctionProvider();
		Condition startBeforeEnd = functionProvider.greatest(allStarts).lessThan(functionProvider.least(allEnds));

		Condition startIsNull = allStarts.stream()
										 .map(Field::isNull)
										 .reduce(Condition::or)
										 .orElseThrow();

		Condition intermediateTableCondition = startIsNull.orNot(startBeforeEnd);

Das gibt es auch in AnsiSqlDateAggregator. Sind die Wiederholungen notwendig?

@awildturtok
awildturtok force-pushed the feature/move-row-numbering-to-preprocessing-cte branch 2 times, most recently from 3c6b5a4 to 53171d7 Compare November 11, 2026 16:15
@awildturtok
awildturtok requested a review from thoniTUB November 11, 2026 16:25
@awildturtok
awildturtok force-pushed the feature/move-row-numbering-to-preprocessing-cte branch 2 times, most recently from 443431a to 9710fea Compare November 12, 2026 15:38
Base automatically changed from feature/complete-sql-selects to develop November 17, 2026 15:49
awildturtok and others added 7 commits November 24, 2026 15:12
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Co-Authored-By: Codex GPT-5 <codex@openai.com>
@awildturtok
awildturtok force-pushed the feature/move-row-numbering-to-preprocessing-cte branch from 9710fea to 4344b06 Compare November 24, 2026 14:29
@awildturtok
awildturtok added this pull request to the merge queue Nov 24, 2026
Merged via the queue into develop with commit 6f21c56 Nov 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants