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

Support aggregation function in window #9758

Merged
merged 72 commits into from
Feb 14, 2025
Merged

Conversation

xzhangxian1008
Copy link
Contributor

@xzhangxian1008 xzhangxian1008 commented Jan 2, 2025

What problem does this PR solve?

Issue Number: close #7376

Problem Summary:

What is changed and how it works?


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Support aggregation function in window function in for TiFlash

@@ -32,6 +32,7 @@ void AlignedBuffer::alloc(size_t size, size_t alignment)
fmt::format("Cannot allocate memory (posix_memalign), size: {}, alignment: {}.", size, alignment),
ErrorCodes::CANNOT_ALLOCATE_MEMORY,
res);
assert(buf == nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete if in L41? check: https://en.cppreference.com/w/cpp/memory/c/free

done

@@ -265,17 +267,54 @@ void WindowTransformAction::initialPartitionAndOrderColumnIndices()

void WindowTransformAction::initialWorkspaces()
{
// Initialize window function workspaces.
workspaces.reserve(window_description.window_functions_descriptions.size());
auto workspace_num = window_description.window_functions_descriptions.size();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto workspace_num = window_description.window_functions_descriptions.size();
const auto workspace_num = window_description.window_functions_descriptions.size();

for (auto & ws : aggregation_workspaces)
{
RowNumber start = frame_start;
if (need_decrease && checkIfNeedDecrease())
Copy link
Contributor

Choose a reason for hiding this comment

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

checkIfNeedDecrease() can be called before this loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

checkIfNeedDecrease() can be called before this loop

done

append_add = true;
}

bool check_need_decrease = checkIfNeedDecrease();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool check_need_decrease = checkIfNeedDecrease();
bool check_need_decrease = false;
if constexpr(need_decrease)
check_need_decrease = checkIfNeedDecrease();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

for (auto & ws : aggregation_workspaces)
{
RowNumber start = frame_start;
if (need_decrease && check_need_decrease)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (need_decrease && check_need_decrease)
if (check_need_decrease)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@xzhangxian1008
Copy link
Contributor Author

/cc @guo-shaoge

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Feb 14, 2025
@ti-chi-bot ti-chi-bot bot added the lgtm label Feb 14, 2025
Copy link
Contributor

ti-chi-bot bot commented Feb 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guo-shaoge, windtalker

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [guo-shaoge,windtalker]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 14, 2025
Copy link
Contributor

ti-chi-bot bot commented Feb 14, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-14 04:58:10.119539994 +0000 UTC m=+591732.515762054: ☑️ agreed by windtalker.
  • 2025-02-14 05:55:06.111459417 +0000 UTC m=+595148.507681479: ☑️ agreed by guo-shaoge.

@ti-chi-bot ti-chi-bot bot merged commit f7f2fdd into pingcap:master Feb 14, 2025
5 checks passed
@xzhangxian1008 xzhangxian1008 deleted the wagg branch February 14, 2025 06:22
@xzhangxian1008
Copy link
Contributor Author

/cherrypick release-8.5-20250310-v8.5.1

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Mar 11, 2025
@ti-chi-bot
Copy link
Member

@xzhangxian1008: new pull request created to branch release-8.5-20250310-v8.5.1: #9980.

In response to this:

/cherrypick release-8.5-20250310-v8.5.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

ti-chi-bot bot pushed a commit that referenced this pull request Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window functions
4 participants