-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
executor: support Chunk for TableDualExec #5395
Conversation
numDualRows is always 1. |
executor/builder.go
Outdated
return nil | ||
} | ||
dualSchema := v.Schema() | ||
if dualSchema.Len() == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change the schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the schema can not be empty, we need to use it to build a chunk for TableDualExec
and append some value into it to indicate there exists some rows in that chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this work should be done in plan building stage
/run-all-tests |
…into dev/chunk/tabledual
/run-all-tests |
/run-all-tests |
@hanfei1991 @coocood PTAL |
@zz-jason |
Please resolve the conflicts. |
executor/adapter.go
Outdated
if e.Schema().Len() == 0 { | ||
return a.handleNoDelayExecutor(goCtx, e, ctx, pi) | ||
} else if proj, ok := e.(*ProjectionExec); ok && proj.calculateNoDelay { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment this condition branch. Why we need this?
plan/planbuilder.go
Outdated
@@ -257,7 +270,11 @@ func (b *planBuilder) buildSet(v *ast.SetStmt) Plan { | |||
vars.Value = ast.NewValueExpr(cn.Name.Name.O) | |||
} | |||
mockTablePlan := LogicalTableDual{}.init(b.ctx) | |||
mockTablePlan.SetSchema(expression.NewSchema()) | |||
mockTablePlan.SetSchema(expression.NewSchema(&expression.Column{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is changed.
/run-all-tests |
/run-all-tests |
LGTM |
util/chunk/chunk.go
Outdated
@@ -174,6 +186,7 @@ func (c *Chunk) Append(other *Chunk, begin, end int) { | |||
dst.length++ | |||
} | |||
} | |||
c.numVirtualRows += other.numVirtualRows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add all other.numVirtualRows? if we call Append more than once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a mistake, fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/ok-to-test |
/rebuild |
/run-all-tests |
plan/planbuilder.go
Outdated
p.SetChildren(dual) | ||
p.self = p | ||
p.SetSchema(expression.NewSchema()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
to #5261