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

support json_length(json, path) #8718

Merged
merged 15 commits into from
Feb 5, 2024
Merged

Conversation

SeaRise
Copy link
Contributor

@SeaRise SeaRise commented Jan 22, 2024

What problem does this PR solve?

Issue Number: close #8711

Problem Summary:

What is changed and how it works?

see https://github.com/pingcap/tidb/blob/c47f4c914624371442ce49bf42956496c1593963/pkg/expression/builtin_json.go#L1768-L1802

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 22, 2024
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 22, 2024
@SeaRise SeaRise changed the title WIP: support json_length(json, path) support json_length(json, path) Jan 22, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 22, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 22, 2024

/run-all-tests

@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 22, 2024

/run-all-tests

@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 22, 2024

/run-all-test

@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 22, 2024

/run-all-test

@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 22, 2024

/run-all-tests

@SeaRise
Copy link
Contributor Author

SeaRise commented Jan 24, 2024

run-unit-test

dbms/src/Functions/FunctionsJson.h Show resolved Hide resolved
|| extract_json_binary.getType() == JsonBinary::TYPE_CODE_OBJECT)
data_to[row] = extract_json_binary.getElementCount();
}
FINISH_PER_ROW
Copy link
Contributor

Choose a reason for hiding this comment

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

If the current json is not json_array or json_object, no matter the path is, it will always return 1, is it the expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

waiting for pingcap/tidb#50933

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 2, 2024

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 2, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 2, 2024

wait for pingcap/tidb#50933

@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 4, 2024

/hold cancel

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 4, 2024

/run-all-tests

@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 4, 2024

/run-integration-test

1 similar comment
@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 4, 2024

/run-integration-test

assert(json_val.size > 0);
JsonBinary json_binary(json_val.data[0], StringRef(&json_val.data[1], json_val.size - 1));

if constexpr (is_path_nullable)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be moved before L732

Copy link
Contributor Author

@SeaRise SeaRise Feb 4, 2024

Choose a reason for hiding this comment

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

ok, updated.

null_map_to[row] = 1;
continue;
}
assert(extract_json_binaries.size() == 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What hapens if the path contains *?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Feb 4, 2024
Copy link
Contributor

@yibin87 yibin87 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 5, 2024
Copy link
Contributor

ti-chi-bot bot commented Feb 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: windtalker, yibin87

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

ti-chi-bot bot commented Feb 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-02-04 10:02:25.931195926 +0000 UTC m=+91871.497965801: ☑️ agreed by windtalker.
  • 2024-02-05 01:30:33.694683126 +0000 UTC m=+147559.261453001: ☑️ agreed by yibin87.

Copy link
Contributor

ti-chi-bot bot commented Feb 5, 2024

@SeaRise: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 5, 2024

/run-unit-test

1 similar comment
@SeaRise
Copy link
Contributor Author

SeaRise commented Feb 5, 2024

/run-unit-test

@ti-chi-bot ti-chi-bot bot merged commit c2b76f9 into pingcap:master Feb 5, 2024
6 checks passed
@SeaRise SeaRise deleted the fix_for_json_length branch February 5, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

json_length(json_col, path_col) return unexpect error
3 participants