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

feat: add window function first_value and last_value #11587

Merged
merged 4 commits into from
May 26, 2023

Conversation

gitccl
Copy link
Contributor

@gitccl gitccl commented May 25, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Add window function first_value and last_value.

Part of #11148

@vercel
Copy link

vercel bot commented May 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
databend ⬜️ Ignored (Inspect) May 26, 2023 6:51am

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label May 25, 2023
@ariesdevil
Copy link
Contributor

The first_value can be aliased to first and the last_value is the same, you can do alias here.

Copy link
Contributor

@RinChanNOWWW RinChanNOWWW left a comment

Choose a reason for hiding this comment

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

We just need to push the value at frame_start (when frame_started) and frame_end - 1 (when frame_ended) to the result.

Copy link
Contributor

@RinChanNOWWW RinChanNOWWW left a comment

Choose a reason for hiding this comment

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

The method resolve_general_window_function in src/query/sql/src/planner/semantic/type_check.rs is for lag and lead only now, should modify it.

Copy link
Contributor

@RinChanNOWWW RinChanNOWWW left a comment

Choose a reason for hiding this comment

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

LGTM

@mergify mergify bot merged commit 1a35996 into databendlabs:main May 26, 2023
@gitccl gitccl deleted the window_func branch May 26, 2023 08:42
andylokandy pushed a commit to andylokandy/databend that referenced this pull request Nov 27, 2023
)

* feat: add window function first_value and last_value

* apply cr

* add nullable column test

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants