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

feat(expr): IS JSON predicate #11831

Merged
merged 2 commits into from
Aug 23, 2023
Merged

feat(expr): IS JSON predicate #11831

merged 2 commits into from
Aug 23, 2023

Conversation

xiangjinwu
Copy link
Contributor

@xiangjinwu xiangjinwu commented Aug 22, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

related: #4458

Functionality-wise, this candidate solution is most limited compared to others. But it is part of the standard (ISO/IEC TR 19075-6:2017) and PostgreSQL is also working on its support. It was implemented and reverted due to regression in PostgreSQL 15, and added back in PostgreSQL 16 (not released yet, so another revert is possible).

Similar to PostgreSQL, we do not support parsing JSON input clause (FORMAT JSON [ ENCODING { UTF8 | UTF16 | UTF32 } ]) before IS. The constraint WITH UNIQUE KEYS can be parsed but not supported for evaluation.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

Support varchar IS [NOT] JSON [ VALUE | ARRAY | OBJECT | SCALAR ] -> bool predicate.

@xiangjinwu xiangjinwu changed the title feat(expr): IS JSON predicate from ISO 19075-6:2017 and PostgreSQL 16 (expected) feat(expr): IS JSON predicate Aug 22, 2023
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #11831 (02f395e) into main (97bb319) will decrease coverage by 0.01%.
Report is 9 commits behind head on main.
The diff coverage is 53.60%.

@@            Coverage Diff             @@
##             main   #11831      +/-   ##
==========================================
- Coverage   70.20%   70.19%   -0.01%     
==========================================
  Files        1372     1372              
  Lines      228481   228574      +93     
==========================================
+ Hits       160394   160442      +48     
- Misses      68087    68132      +45     
Flag Coverage Δ
rust 70.19% <53.60%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/frontend/src/binder/expr/mod.rs 73.96% <0.00%> (-4.03%) ⬇️
src/frontend/src/expr/pure.rs 87.69% <ø> (ø)
src/meta/src/manager/catalog/utils.rs 48.96% <0.00%> (-0.17%) ⬇️
src/sqlparser/src/keywords.rs 100.00% <ø> (ø)
src/expr/src/vector_op/jsonb_info.rs 13.79% <12.50%> (-1.60%) ⬇️
src/sqlparser/src/parser.rs 86.45% <86.11%> (+0.10%) ⬆️
src/sqlparser/src/ast/mod.rs 85.45% <100.00%> (+0.13%) ⬆️
src/sqlparser/src/ast/value.rs 98.91% <100.00%> (+0.08%) ⬆️

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@wangrunji0408 wangrunji0408 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

e2e_test/batch/types/jsonb.slt.part Show resolved Hide resolved
@xiangjinwu xiangjinwu added this pull request to the merge queue Aug 23, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 23, 2023
@wangrunji0408 wangrunji0408 added this pull request to the merge queue Aug 23, 2023
@wangrunji0408 wangrunji0408 removed this pull request from the merge queue due to a manual request Aug 23, 2023
@xiangjinwu xiangjinwu added this pull request to the merge queue Aug 23, 2023
Merged via the queue into main with commit 70bd7ea Aug 23, 2023
9 of 10 checks passed
@xiangjinwu xiangjinwu deleted the feat-expr-is-json branch August 23, 2023 10:00
@neverchanje neverchanje added the user-facing-changes Contains changes that are visible to users label Aug 23, 2023
Li0k pushed a commit that referenced this pull request Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants