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

ddl: don't rely on expression.Column.ColName #11255

Merged
merged 4 commits into from
Jul 23, 2019

Conversation

winoros
Copy link
Member

@winoros winoros commented Jul 15, 2019

What problem does this PR solve?

Clean the dependencies of expression.Column.

What is changed and how it works?

Directly extract the columns. Don't build expression and use expression.Column.ColName.

Check List

Tests

  • Existing Unit test

@winoros winoros added the type/enhancement The issue or PR belongs to an enhancement. label Jul 15, 2019
@winoros winoros force-pushed the dont-relyon-expression-column-name branch from 6e41a73 to 15a379b Compare July 15, 2019 09:09
@codecov
Copy link

codecov bot commented Jul 15, 2019

Codecov Report

Merging #11255 into master will decrease coverage by 0.004%.
The diff coverage is 91.8918%.

@@               Coverage Diff                @@
##             master     #11255        +/-   ##
================================================
- Coverage   81.2684%   81.2643%   -0.0041%     
================================================
  Files           423        423                
  Lines         90094      90117        +23     
================================================
+ Hits          73218      73233        +15     
- Misses        11581      11586         +5     
- Partials       5295       5298         +3

@codecov
Copy link

codecov bot commented Jul 15, 2019

Codecov Report

Merging #11255 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #11255   +/-   ##
=======================================
  Coverage   81.33%   81.33%           
=======================================
  Files         423      423           
  Lines       90750    90750           
=======================================
  Hits        73807    73807           
  Misses      11632    11632           
  Partials     5311     5311


func extractPartitionColumns(partExpr string, tblInfo *model.TableInfo) ([]*model.ColumnInfo, error) {
partExpr = "select " + partExpr
stmts, _, err := parser.New().Parse(partExpr, "", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we handle warnings like ParseSimpleExprWithTableInfo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need. The warning generated before is not handled either.

@winoros winoros requested a review from alivxxx July 17, 2019 16:12
@qw4990 qw4990 self-requested a review July 18, 2019 05:45
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 18, 2019
@winoros winoros requested a review from qw4990 July 18, 2019 16:47
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 19, 2019
}
extractor := &columnNameExtractor{
tblInfo: tblInfo,
extractedColumns: make([]*model.ColumnInfo, 0),
Copy link
Member

@ngaut ngaut Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep extractedColumns as nil

@tiancaiamao
Copy link
Contributor

/run-all-tests

@winoros winoros merged commit d47b655 into pingcap:master Jul 23, 2019
@winoros winoros deleted the dont-relyon-expression-column-name branch July 23, 2019 05:56
winoros added a commit to winoros/tidb that referenced this pull request Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants