Skip to content

[BugFix] Respect ALLOW_THROW_EXCEPTION in parse_json#74953

Closed
Hyper-FF wants to merge 2 commits into
StarRocks:mainfrom
Hyper-FF:fix_parse_json_throw_exception
Closed

[BugFix] Respect ALLOW_THROW_EXCEPTION in parse_json#74953
Hyper-FF wants to merge 2 commits into
StarRocks:mainfrom
Hyper-FF:fix_parse_json_throw_exception

Conversation

@Hyper-FF

Copy link
Copy Markdown
Contributor

Why I'm doing:

parse_json() swallowed JSON parse errors by appending NULL even when sql_mode='ALLOW_THROW_EXCEPTION', while get_json_string was fixed to raise in that mode by #73199. Mirror that fix in JsonFunctions::parse_json so malformed JSON fails the query (e.g. INSERT..SELECT) instead of silently producing NULL. Default (non-strict) behavior is unchanged.

Add test/sql/test_json SQL test covering parse_json vs get_json_string under ALLOW_THROW_EXCEPTION.

What I'm doing:

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

parse_json() swallowed JSON parse errors by appending NULL even when
sql_mode='ALLOW_THROW_EXCEPTION', while get_json_string was fixed to
raise in that mode by StarRocks#73199. Mirror that fix in JsonFunctions::parse_json
so malformed JSON fails the query (e.g. INSERT..SELECT) instead of
silently producing NULL. Default (non-strict) behavior is unchanged.

Add test/sql/test_json SQL test covering parse_json vs get_json_string
under ALLOW_THROW_EXCEPTION.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ hyper
❌ Hyper-FF


hyper seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@github-actions github-actions Bot requested review from stdpain and trueeyu June 17, 2026 09:25
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 7f6827e3b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: Hyper-FF <253014618+Hyper-FF@users.noreply.github.com>
@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@Hyper-FF Hyper-FF closed this Jun 18, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: b8210e25fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

fail : 1 / 2 (50.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exprs/json_functions.cpp 1 2 50.00% [295]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants