-
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
*: remove FromID
from expression.Column
#7157
Conversation
/run-all-tests |
/run-integration-ddl-test |
/run-sqllogic-test |
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 you also update the comment for Position?
plan/rule_aggregation_push_down.go
Outdated
@@ -169,14 +169,13 @@ func (a *aggregationOptimizer) checkValidJoin(join *LogicalJoin) bool { | |||
|
|||
// decompose splits an aggregate function to two parts: a final mode function and a partial mode function. Currently | |||
// there are no differences between partial mode and complete mode, so we can confuse them. | |||
func (a *aggregationOptimizer) decompose(aggFunc *aggregation.AggFuncDesc, schema *expression.Schema, id int) ([]*aggregation.AggFuncDesc, *expression.Schema) { | |||
func (a *aggregationOptimizer) decompose(ctx sessionctx.Context, aggFunc *aggregation.AggFuncDesc, schema *expression.Schema, id int) ([]*aggregation.AggFuncDesc, *expression.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.
id
is not used?
expression/distsql_builtin_test.go
Outdated
return s.colID | ||
} | ||
|
||
// generateSchema will generate a schema for test. Used only in this file. |
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.
Actually, it is only used in schema_test.go
.
plan/find_best_task.go
Outdated
@@ -337,6 +337,14 @@ func (ds *DataSource) convertToIndexScan(prop *requiredProp, path *accessPath) ( | |||
} | |||
rowCount := path.countAfterAccess | |||
cop := &copTask{indexPlan: is} | |||
names1 := make([]string, 0, len(is.Columns)) | |||
names2 := make([]string, 0, len(is.Index.Columns)) |
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.
What's their usage?
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.
oh it's for debugging.
/run-sqllogic-test |
/run-all-tests |
@winoros please address the comments. |
// Position means the position of this column that appears in the select fields. | ||
// e.g. SELECT name as id , 1 - id as id , 1 + name as id, name as id from src having id = 1; | ||
// There are four ids in the same schema, so you can't identify the column through the FromID and ColName. | ||
// Position is the unique id of this 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.
We may need to comment for the difference between ID and Position.
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 will be done is the future, not this pr.
// FindColumnByName finds a column by its name. | ||
func (s *Schema) FindColumnByName(name string) *Column { | ||
for _, col := range s.Columns { | ||
if col.ColName.L == name { |
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.
Should we take the DBName and TableName into consideration?
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.
No, this is only used for datasource which only have one table.
// Position means the position of this column that appears in the select fields. | ||
// e.g. SELECT name as id , 1 - id as id , 1 + name as id, name as id from src having id = 1; | ||
// There are four ids in the same schema, so you can't identify the column through the FromID and ColName. | ||
// Position is the unique id of this column. | ||
Position int |
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.
I'll rename it to UniqueID
or something after this pr.
I'll examine whether the ID
of Column
can be removed.
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
@XuHuaiyu @lamxTyler PTAL |
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
What have you changed? (mandatory)
Remove the
FromID
fromexpression.Column
.What is the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
existing test.