Skip to content

Commit

Permalink
plan: update comment wording (#7238)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitinChen authored and coocood committed Aug 2, 2018
1 parent 5e7aa1d commit cc1c3be
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plan/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,10 +1110,10 @@ func (b *planBuilder) buildValuesListOfInsert(insert *ast.InsertStmt, insertPlan
return
}

// If the value_list and col_list is empty and we have generated column, we can still write to this table.
// i.e. insert into t values(); can be executed successfully if t have generated column.
// If value_list and col_list are empty and we have a generated column, we can still write data to this table.
// For example, insert into t values(); can be executed successfully if t has a generated column.
if len(insert.Columns) > 0 || len(insert.Lists[0]) > 0 {
// If value_list is not empty or the col_list is not empty, length of value_list should be the same with col_list's.
// If value_list or col_list is not empty, the length of value_list should be the same with that of col_list.
if len(insert.Lists[0]) != len(affectedValuesCols) {
b.err = ErrWrongValueCountOnRow.GenByArgs(1)
return
Expand All @@ -1129,7 +1129,7 @@ func (b *planBuilder) buildValuesListOfInsert(insert *ast.InsertStmt, insertPlan

totalTableCols := insertPlan.Table.Cols()
for i, valuesItem := range insert.Lists {
// The length of the all the value_list should be the same.
// The length of all the value_list should be the same.
// "insert into t values (), ()" is valid.
// "insert into t values (), (1)" is not valid.
// "insert into t values (1), ()" is not valid.
Expand Down Expand Up @@ -1178,7 +1178,7 @@ func (b *planBuilder) buildSelectPlanOfInsert(insert *ast.InsertStmt, insertPlan
return
}

// Check that the length of select' row is equal to the col list.
// Check to guarantee that the length of the row returned by select is equal to that of affectedValuesCols.
if selectPlan.Schema().Len() != len(affectedValuesCols) {
b.err = ErrWrongValueCountOnRow.GenByArgs(1)
return
Expand Down

0 comments on commit cc1c3be

Please sign in to comment.