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

[BugFix] try to parse it when casting string to json #7835

Merged
merged 2 commits into from Jun 25, 2022

Conversation

mofeiatwork
Copy link
Contributor

@mofeiatwork mofeiatwork commented Jun 25, 2022

What type of PR is this:

  • bug
  • feature
  • enhancement
  • refactor
  • others

Which issues of this PR fixes :

Fixes #8127

Problem Summary(Required) :

Before

mysql> select cast('1'as json);
-------------------------------------------
"1"

After

mysql> select cast('1' as json);
-------------------------------------------
1

This change would make the implicit casting behavior more user-friendly, in most cases user do not need to manually call the parse_json function.

E.g. Before this PR, user should write select json_query(parse_json('{"a": 1}), 'a') to get a valid JSON, but not the select json_query('{"a": 1}', 'a'). Cause the second case insert an implicit cast(varchar as json) , which would tread the varchar as a json subtype string, but not parse it as a json object.

@mofeiatwork
Copy link
Contributor Author

@Mergifyio backport branch-2.3

@mergify
Copy link
Contributor

mergify bot commented Jun 25, 2022

backport branch-2.3

🟠 Waiting for conditions to match

  • merged [:pushpin: backport requirement]

@stdpain stdpain merged commit 0edb37a into StarRocks:main Jun 25, 2022
mergify bot pushed a commit that referenced this pull request Jun 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 25, 2022

backport branch-2.3

✅ Backports have been created

@mofeiatwork
Copy link
Contributor Author

@Mergifyio backport branch-2.2

1 similar comment
@mofeiatwork
Copy link
Contributor Author

@Mergifyio backport branch-2.2

@mergify
Copy link
Contributor

mergify bot commented Jun 29, 2022

backport branch-2.2

✅ Backports have been created

kangkaisen pushed a commit that referenced this pull request Jun 29, 2022
(cherry picked from commit 0edb37a)

Co-authored-by: Murphy <96611012+mofeiatwork@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Try to parse json string when load string into JSON
3 participants