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

MDEV-26182: Implement JSON_INTERSECT() #2261

Open
wants to merge 1 commit into
base: 10.11
Choose a base branch
from

Conversation

tanruixiang
Copy link
Contributor

@tanruixiang tanruixiang commented Sep 7, 2022

  • The Jira issue number for this PR is: MDEV-26182

Description

This pr adds JSON_INTERSECT(). This function can get the intersection between two jsons.
The behavior of intersection of different types is different. Taking the intersection of two objects is taking their common KV pairs. The intersection of array and array is to take their common elements. There is no intersection between scalar and object. An object and a scalar take an intersection with an array. As long as the object or scalar exists in the array, the intersection is the object or the scalar.
We put a json into the hash, scan another json, and efficiently get the intersection by reading and updating the hash information.

NOTE: This pr is for the Google Summer of Code 2022.

How can this PR be tested?

./mtr func_json
./mtr json_debug_nonembedded

Basing the PR against the correct MariaDB version

  • This is a new feature and the PR is based against the latest MariaDB development branch
  • This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduced

The behavior of intersection of different types is different. Taking the
intersection of two objects is taking their common KV pairs. The intersection
of array and array is to take their common elements. There is no intersection
between scalar and object. An object and a scalar take an intersection with an
array. As long as the object or scalar exists in the array, the intersection
is the object or the scalar.

We put a json into the hash, scan another json, and efficiently get the
intersection by reading and updating the hash information.
@CLAassistant
Copy link

CLAassistant commented Sep 7, 2022

CLA assistant check
All committers have signed the CLA.

@tanruixiang tanruixiang changed the title MDEV-26182: Implement JSON_INTERSECT()(GSoC) MDEV-26182: Implement JSON_INTERSECT() Sep 8, 2022
@MariaDB MariaDB deleted a comment from Hinal-Srivastava Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants