-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
schemadiff
small internal refactor: formalizing column charset/collation
#16239
schemadiff
small internal refactor: formalizing column charset/collation
#16239
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
…CharsetCollate() Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16239 +/- ##
==========================================
+ Coverage 68.61% 68.72% +0.11%
==========================================
Files 1544 1547 +3
Lines 197993 198274 +281
==========================================
+ Hits 135848 136266 +418
+ Misses 62145 62008 -137 ☔ View full report in Codecov by Sentry. |
@@ -454,6 +454,15 @@ func NewCreateTableEntity(env *Environment, c *sqlparser.CreateTable) (*CreateTa | |||
return entity, nil | |||
} | |||
|
|||
func (c *CreateTableEntity) ColumnDefinitionEntities() []*ColumnDefinitionEntity { |
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 don't see where this is used ...
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.
You're right. This is preparation work for a later PR (WIP: #16256).
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.
Only one minor comment. There's no new tests added here, but I'm assuming that the behavior is covered by the existing tests, correct?
go/vt/schemadiff/column.go
Outdated
if c.columnDefinition.Type.Options.Collate == "" { | ||
c.columnDefinition.Type.Options.Collate = c.tableCharsetCollate.collate | ||
} |
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 do this when we blindly set c.columnDefinition.Type.Options.Collate = c.tableCharsetCollate.collate
in the subsequent IF condition?
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.
Good catch! Removed.
That's right. It's an internal refactor with no new behavioral change, hence covered by existing tests. |
Signed-off-by: Shlomi Noach <[email protected]>
Description
This PR does some internal refactoring/cleanup without changing behavior. We give
ColumnDefinitionEntity
some more brainpower, cleanup column diffing (introducingSetExplicitCharsetCollate
and simplifyingColumnDiff()
.Related Issue(s)
As part of #16229
Checklist
Deployment Notes