expression: do not set ParseToJSONFlag to a JSON column#8564
Merged
XuHuaiyu merged 7 commits intopingcap:masterfrom Dec 12, 2018
Merged
expression: do not set ParseToJSONFlag to a JSON column#8564XuHuaiyu merged 7 commits intopingcap:masterfrom
XuHuaiyu merged 7 commits intopingcap:masterfrom
Conversation
Contributor
Author
|
/run-all-tests |
winoros
reviewed
Dec 4, 2018
Contributor
Author
Contributor
Author
|
/run-common-test tidb-test=pr/676 |
Contributor
Author
|
/run-common-test |
zz-jason
reviewed
Dec 6, 2018
expression/builtin_compare.go
Outdated
| // Moreover, Column.RetType refers to the infoschema, if we modify | ||
| // it, data race may happen if another goroutine read from the | ||
| // infoschema at the same time. | ||
| if _, isColumn := args[i].(*Column); isColumn { |
Member
There was a problem hiding this comment.
Can we extract a common function to do it? There are a lot of duplicated code and comments.
Contributor
Author
|
/run-common-test tidb-test=pr/676 |
Contributor
Author
|
/run-all-tests |
XuHuaiyu
added a commit
to XuHuaiyu/tidb
that referenced
this pull request
Dec 12, 2018
XuHuaiyu
added a commit
to XuHuaiyu/tidb
that referenced
this pull request
Dec 12, 2018
This was referenced Dec 12, 2018
ngaut
pushed a commit
that referenced
this pull request
Dec 12, 2018
iamzhoug37
pushed a commit
to iamzhoug37/tidb
that referenced
this pull request
Dec 13, 2018
zz-jason
pushed a commit
that referenced
this pull request
Dec 13, 2018
This was referenced Apr 22, 2019
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Do not set ParseToJSONFlag to a JSON column which can avoid the data race when another goroutine tries to read the column's flag.
What is changed and how it works?
ParseToJSONFlag is used to effect the behavior of castStringAsJSON.
If ParseToJSONFlag is set, we invoke
json.ParseBinaryFromString(str)to parse this string to a JSON, wherestrmust be a valid JSON-string (e.g. '"abc"').Or, we use json.CreateBinary(str) to wrap this string as a JSON directly without check.
ParseToJSONFlag is introduced to resolve the compatibility of compare function and JSON-related function with MySQL.
e.g.:
For a JSON column, we do not need to set this flag for it.
Check List
Tests
Code changes
Side effects
N/A
Related changes
release-2.1 release-2.0
This change is