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): add jsonb_pretty function #13050

Merged
merged 4 commits into from
Oct 27, 2023
Merged

feat(expr): add jsonb_pretty function #13050

merged 4 commits into from
Oct 27, 2023

Conversation

wangrunji0408
Copy link
Contributor

@wangrunji0408 wangrunji0408 commented Oct 25, 2023

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

What's changed and what's your intention?

As title. based on #11805

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 jsonb_pretty function.

jsonb_pretty ( jsonb ) → text
Converts the given JSON value to pretty-printed, 4 spaces indented text.
jsonb_pretty('[{"f1":1,"f2":null}, 2]') →
[
    {
        "f1": 1,
        "f2": null
    },
    2
]

@wangrunji0408 wangrunji0408 requested review from xiangjinwu and st1page and removed request for st1page October 25, 2023 07:08
Copy link
Contributor

@xiangjinwu xiangjinwu left a comment

Choose a reason for hiding this comment

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

lgtm, but maybe sqllogictest cannot handle multiline output well.

Are we able to uncomment these?

--@ select jsonb_pretty('{"a": "test", "b": [1, 2, 3], "c": "test3", "d":{"dd": "test4", "dd2":{"ddd": "test5"}}}');
--@ select jsonb_pretty('[{"f1":1,"f2":null},2,null,[[{"x":true},6,7],8],3]');
--@ select jsonb_pretty('{"a":["b", "c"], "d": {"e":"f"}}');

Base automatically changed from wrj/flat-json to main October 25, 2023 09:08
@buildkite buildkite bot requested a review from a team as a code owner October 25, 2023 09:08
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
@wangrunji0408 wangrunji0408 mentioned this pull request Oct 27, 2023
23 tasks
Signed-off-by: Runji Wang <wangrunji0408@163.com>
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #13050 (4d6af6a) into main (e48547d) will increase coverage by 0.00%.
Report is 30 commits behind head on main.
The diff coverage is 24.00%.

@@           Coverage Diff           @@
##             main   #13050   +/-   ##
=======================================
  Coverage   68.56%   68.56%           
=======================================
  Files        1496     1496           
  Lines      251504   251513    +9     
=======================================
+ Hits       172439   172453   +14     
+ Misses      79065    79060    -5     
Flag Coverage Δ
rust 68.56% <24.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
src/frontend/src/binder/expr/function.rs 78.46% <100.00%> (+0.01%) ⬆️
src/frontend/src/expr/pure.rs 87.69% <ø> (ø)
src/expr/impl/src/scalar/jsonb_info.rs 0.00% <0.00%> (ø)
src/risedevtool/src/bin/risedev-docslt.rs 0.00% <0.00%> (ø)
src/common/src/types/jsonb.rs 34.94% <31.25%> (-2.65%) ⬇️

... and 6 files with indirect coverage changes

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

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.

None yet

2 participants