-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
expression: add builtin function JSON_DEPTH #8347
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
/ok-to-test |
@pingyu Thanks! |
/run-all-tests |
/run-integration-common-test |
@shenli With pleasure. I'm quite new to Go & contributing. Just tell me if I did something wrong. Thank you :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Please add tests in expression package too.
0187dc4
to
4aada52
Compare
@winoros tests in expression package added. PTAL. Thanks. |
4b25606
to
e94887c
Compare
@eurekaka PTAL. Thanks. |
Currently, UT in |
@eurekaka Got it. Thanks. |
expression/builtin_json.go
Outdated
} | ||
|
||
argTps := make([]types.EvalType, 0, len(args)) | ||
argTps = append(argTps, types.ETJson) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function json_depth()
only accepts a single argument: https://github.com/pingcap/tidb/blob/master/expression/builtin.go#L596
how about:
bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETInt, types.ETJson)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Improve codes of function `getFunction` of jsonDepthFunctionClass
e94887c
to
57dec44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-common-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 4 files at r1, 3 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @eurekaka)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 4 files at r1, 3 of 3 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @eurekaka)
Just approved, will be merged in minutes: pingcap/tidb#8347
Just approved, will be merged in minutes: pingcap/tidb#8347
What problem does this PR solve?
Add json builtin function
JSON_DEPTH
described in #7546What is changed and how it works?
Add struct
builtinJSONDepthSig
, and addGetElemDepth
to BinaryJSONCheck List
Tests
Code changes
Add GetElemDepth to BinaryJSON in types/json/binary_functions.go
Side effects
Related changes
This change is