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

planner: support window function #8630

Merged
merged 29 commits into from Jan 3, 2019

Conversation

@lamxTyler
Copy link
Member

lamxTyler commented Dec 10, 2018

What problem does this PR solve?

Support the window function in planner.

What is changed and how it works?

Add logical and physical plan operator for window function. It resolves the name in window function before projection, and build the window funtion after processing the having clause. For partition by and order by clause in window functioin, it adds sort operator as it's child.
The named window and frame clause will be processed in next PR.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

PTAL @zz-jason @winoros @XuHuaiyu @eurekaka


This change is Reviewable

@shenli shenli added this to In progress in window function via automation Dec 10, 2018

@@ -0,0 +1,29 @@
// Copyright 2018 PingCAP, Inc.

This comment has been minimized.

@winoros

winoros Dec 10, 2018

Member

should it belong to aggregation?

This comment has been minimized.

@lamxTyler

lamxTyler Dec 10, 2018

Member

Change the package name to udf or something else?

This comment has been minimized.

@zz-jason

zz-jason Dec 10, 2018

Member

No need to, window function is also a kind of aggregate function.

This comment has been minimized.

@winoros

winoros Dec 10, 2018

Member

But its behavior is quite different with normal aggregate function since it won't make the rows grouped into one though there's OVER clause.
I think they should be in the same level not superior-subordinate.

Show resolved Hide resolved planner/core/logical_plan_builder.go Outdated
Show resolved Hide resolved planner/core/logical_plan_builder.go Outdated

lamxTyler and others added some commits Dec 10, 2018

@@ -0,0 +1,29 @@
// Copyright 2018 PingCAP, Inc.

This comment has been minimized.

@zz-jason

zz-jason Dec 10, 2018

Member

No need to, window function is also a kind of aggregate function.

Show resolved Hide resolved planner/core/initialize.go Outdated
Show resolved Hide resolved planner/core/initialize.go Outdated
Show resolved Hide resolved planner/core/logical_plans.go Outdated
Show resolved Hide resolved planner/core/exhaust_physical_plans.go Outdated
@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Dec 13, 2018

Show resolved Hide resolved planner/core/explain.go
Show resolved Hide resolved planner/core/logical_plans.go
Show resolved Hide resolved planner/core/expression_rewriter.go
Show resolved Hide resolved planner/core/exhaust_physical_plans.go Outdated
Show resolved Hide resolved planner/core/explain.go
Show resolved Hide resolved planner/core/logical_plan_builder.go Outdated
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/logical_plan_builder.go Outdated
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/logical_plans.go Outdated

lamxTyler added some commits Dec 26, 2018

@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Dec 28, 2018

Show resolved Hide resolved planner/core/logical_plan_builder.go Outdated
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/stringer.go Outdated
@zz-jason
Copy link
Member

zz-jason left a comment

LGTM

@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Jan 2, 2019

PTAL @winoros

Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/logical_plan_builder.go
Show resolved Hide resolved planner/core/stats.go
Show resolved Hide resolved planner/core/rule_column_pruning.go

lamxTyler added some commits Jan 3, 2019

window function automation moved this from In progress to Reviewer approved Jan 3, 2019

@eurekaka
Copy link
Contributor

eurekaka left a comment

LGTM

@eurekaka eurekaka added status/LGT2 and removed status/LGT1 labels Jan 3, 2019

@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Jan 3, 2019

/run-all-tests

window function automation moved this from Reviewer approved to Needs review Jan 3, 2019

@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Jan 3, 2019

/run-unit-test

@lamxTyler

This comment has been minimized.

Copy link
Member

lamxTyler commented Jan 3, 2019

I updated the parser, PTAL @eurekaka

window function automation moved this from Needs review to Reviewer approved Jan 3, 2019

@lamxTyler lamxTyler merged commit 91cdbf2 into pingcap:master Jan 3, 2019

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

window function automation moved this from Reviewer approved to Done Jan 3, 2019

@lamxTyler lamxTyler deleted the lamxTyler:window branch Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment