[MDEV-27911] Implement range notation for json path Created: 2022-02-21  Updated: 2023-08-07  Resolved: 2022-04-15

Status: Closed
Project: MariaDB Server
Component/s: JSON
Fix Version/s: 10.9.1

Type: Task Priority: Major
Reporter: Rucha Deodhar Assignee: Rucha Deodhar
Resolution: Fixed Votes: 1
Labels: Preview_10.9

Issue Links:
PartOf
is part of MDEV-28112 prepare 10.9.0 preview releases Closed
Problem/Incident
causes MDEV-28326 Server crashes in json_path_parts_com... Closed
Relates
relates to MDEV-28071 JSON_EXISTS returns always 1 if it i... Closed
relates to MDEV-28072 JSON_EXTRACT has inconsistent behavio... Closed
relates to MDEV-28075 JSON_VALUE returns first value from a... Closed
relates to MDEV-30304 Json Range only affects first row of ... Closed
relates to MDEV-30308 Query using JSON_EXTRACT on a json ob... Closed

 Description   

Implement range with the to keyword. This gives subsets of JSON arrays in output. Example, $[1 to 4] includes elements starting from 1st index to 4th index in the array.



 Comments   
Comment by Rucha Deodhar [ 2022-03-05 ]

Patch: https://github.com/MariaDB/server/commit/82d7e8199a14c3e522ebb152b4ae9a184e929895

Comment by Alexey Botchkov [ 2022-03-08 ]

ok to push.

Comment by Rucha Deodhar [ 2022-03-09 ]

pushed to preview branch: preview-10.9-MDEV-27911

Comment by Lena Startseva [ 2022-04-13 ]

Testing done. Please, rucha174, don't forget to add information about behavior for range like [-2 to 1] or [-1 to 1] (see an example) in documentation.

SET @json= '[ 11, 22 , 33]';
SELECT JSON_EXTRACT(@json, '$[-2 to 1]');
SELECT JSON_EXTRACT(@json, '$[-1 to 1]');

Comment by Rucha Deodhar [ 2022-04-13 ]

lstartseva , thank you ! Yes, I have added it in documentation. Added as 'note' under array element selector

Generated at Thu Feb 08 09:56:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.