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 inline projection for executors #14428

Open
6 of 9 tasks
SunRunAway opened this issue Jan 9, 2020 · 28 comments
Open
6 of 9 tasks

Support inline projection for executors #14428

SunRunAway opened this issue Jan 9, 2020 · 28 comments
Assignees
Labels
challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/execution SIG execution sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jan 9, 2020

Description

Is your feature request related to a problem? Please describe:

For example,

select t1.b+1 from t1, t2 where t1.a = t2.a

Join executor reads t1.a and t1.b from table t1, t2.a from table t2, then concatenates and materilizes these three columns. Next step, projection executor projects three columns to one column of t1.b.

Describe the feature you'd like:

We can optimize it by set the output schema of Join executor as only t1.b, so that the executor do know that it only need to output t1.b. It can avoid copying t1.a and t2.a which are not needed by its parent when materilizes/copys data buffers.

Inline Projection

Here's a demostration PR to show how the performance we gain from avoiding copying extra columns for SORT executor.

What we need to do:

Executor Why need this
Sort Copy rows with random access
TopN Copy rows with random access
Join (Hash Join, Merge Join, Index Merge Join, Index Hash Join) Copy rows with random access from build table, join rows from one of the build table and one of the probe table
Apply Copy rows with random access from build table, join rows from one of the build table and one of the probe table
Selection Copy rows with random access
Limit? Prune copying of extra columns

Difficulty

  • Medium

Score

  • 3000

Mentor(s)

Recommended Skills

  • SQL Optimization
  • Golang Profiling
  • Code Refactoring
@SunRunAway SunRunAway added type/enhancement The issue or PR belongs to an enhancement. sig/execution SIG execution help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/new-feature labels Jan 9, 2020
@SunRunAway SunRunAway added the sig/planner SIG: Planner label Jan 17, 2020
@Reminiscent
Copy link
Contributor

I want to do some executors for this.

@SunRunAway
Copy link
Contributor Author

SunRunAway commented Jan 18, 2020

I want to do some executors for this.

Thanks, I've been investigating inline projection for planner and join parts(#14428). I hope I can finish them in these two days, so that you guys can continue to do works for other executors.

@lance6716
Copy link
Contributor

Hi, I want to help to implement this for Merge Join, is it available now? @Reminiscent @SunRunAway

@SunRunAway
Copy link
Contributor Author

Hi, I want to help to implement this for Merge Join, is it available now? @Reminiscent @SunRunAway

Yes. That's great. Looking forward to your PR.

@lance6716
Copy link
Contributor

Hi, I managed to pass tests in #15463, PTAL at your convenience.

I'm going to take Selection, but I didn't know what should I do. Seems that LogicalSelection has already did PruneColumns for its child, there's no reduntant columns which need to do inlineProjection. (BTW, I didn't find where schema of LogicalSelection is set, not familiar with these code 😄 )

@TszKitLo40
Copy link
Contributor

/pick-up limit

@ti-challenge-bot
Copy link

Pick up success.

@TszKitLo40
Copy link
Contributor

Maybe individual issue should be created for each item

@ti-challenge-bot
Copy link

Pick up success.

@hidehalo
Copy link
Contributor

@SunRunAway PTAL #19900 👀

@pingyu
Copy link
Contributor

pingyu commented Sep 21, 2020

/pick-up Limit

@ti-challenge-bot
Copy link

This issue already picked by hidehalo.

@ti-challenge-bot
Copy link

@hidehalo You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 23, 2020
pingyu added a commit to pingyu/tidb that referenced this issue Sep 24, 2020
@newcworld
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@newcworld
Copy link
Contributor

@SunRunAway
I' confusing about the inline projection for Limit. Does it means

select t1.b+1 from t1 limit 3

image
?

btw

could you please give me more explaition about inline projection.
I cannot find it in google.

@SunRunAway
Copy link
Contributor Author

@SunRunAway
I' confusing about the inline projection for Limit. Does it means

select t1.b+1 from t1 limit 3

image
?

btw

could you please give me more explaition about inline projection.
I cannot find it in google.

That's almost right and the top Projection can also be pruned.

And here's a slide for introducing https://docs.google.com/presentation/d/1cjdMjKFMbmQdIaDvTKBHlT9TXcqGJUjgkeylrseTrx8/edit#slide=id.p

@ti-challenge-bot
Copy link

@pengdaqian2020 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Oct 5, 2020
@SunRunAway SunRunAway assigned SunRunAway and unassigned SunRunAway Oct 15, 2020
@YangKian
Copy link
Contributor

/pick-up Apply

@ti-challenge-bot
Copy link

The challenge program issue is already in the assign flow, so you cannot pick up this issue. But the current issue needs help, you can contact @SunRunAway to try to solve this issue together.

@SunRunAway
Copy link
Contributor Author

@YangKian
you can ignore the bot's message and you can still do this issue and get points if your pr is merged.

@SunRunAway SunRunAway assigned pingyu and SunRunAway and unassigned SunRunAway Oct 19, 2020
@YangKian
Copy link
Contributor

@SunRunAway Thanks for reminding~ I'd like to have some try :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/execution SIG execution sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests