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

Remove the Base() *BaseExecutor function from Executor interface #49490

Closed
YangKeao opened this issue Dec 15, 2023 · 0 comments · Fixed by #49494
Closed

Remove the Base() *BaseExecutor function from Executor interface #49490

YangKeao opened this issue Dec 15, 2023 · 0 comments · Fixed by #49494
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@YangKeao
Copy link
Member

YangKeao commented Dec 15, 2023

Enhancement

To eliminate the usage of Ctx from the executors, as the first step, we can remove the abuse of Base() *BaseExecutor from the Executor interface. It can be replaced with

type Executor interface {
	NewChunk() *chunk.Chunk
	NewChunkWithCapacity(fields []*types.FieldType, capacity int, maxCachesize int) *chunk.Chunk

	RuntimeStats() *execdetails.BasicRuntimeStats

	HandleSQLKillerSignal() error
	RegisterSQLAndPlanInExecForTopSQL()

	AllChildren() []Executor

        // ...
}

Actually, some helper functions can be removed, like TryNewCacheChunk, RetTypes... They are just calling the methods of executors after this refractor.

The executors can still use the Ctx inside, by calling .BaseExecutor.Ctx() internally, as it can access the BaseExecutor field and the type of the specific executor is clear.

@YangKeao YangKeao added the type/enhancement The issue or PR belongs to an enhancement. label Dec 15, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant