Skip to content

docs: add json_path_match function documentation (EN + ZH + v1.0)#2358

Merged
fengjiachun merged 4 commits intomainfrom
copilot/update-json-path-match-docs
Mar 6, 2026
Merged

docs: add json_path_match function documentation (EN + ZH + v1.0)#2358
fengjiachun merged 4 commits intomainfrom
copilot/update-json-path-match-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

Documents the json_path_match UDF introduced in GreptimeTeam/greptimedb#4864.

What's Changed in this PR

Added json_path_match(json, path) to the Validation section of the JSON functions reference, alongside the existing json_path_exists. Covers:

  • Behavior: returns 1 or 0 whether the JSON value satisfies the JSONPath predicate expression (e.g. $.a == 1, $.b[1 to last] >= 2)
  • NULL semantics: returns NULL when the JSON value is NULL or the path is invalid/not a predicate
  • SQL examples demonstrating 1, 0, and NULL outcomes
SELECT json_path_match(parse_json('{"a": 1, "b": 2}'), '$.a == 1');
-- 1

SELECT json_path_match(parse_json('{"a":1,"b":[1,2,3]}'), '$.b[0] > 1');
-- 0

SELECT json_path_match(parse_json('null'), '$.a == 1');
-- NULL

Updated all four relevant files:

  • docs/reference/sql/functions/json.md (EN current)
  • i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/functions/json.md (ZH current)
  • versioned_docs/version-1.0/reference/sql/functions/json.md (EN v1.0)
  • i18n/zh/docusaurus-plugin-content-docs/version-1.0/reference/sql/functions/json.md (ZH v1.0)

Checklist

  • Please confirm that all corresponding versions of the documents have been revised.
  • Please ensure that the content in sidebars.ts matches the current document structure when you changed the document structure.
  • This change requires follow-up update in localized docs.
Original prompt

This section details on the original issue you should resolve

<issue_title>Update docs for feat: add json_path_match udf</issue_title>
<issue_description>A document change request is generated from GreptimeTeam/greptimedb#4864</issue_description>

<agent_instructions>Write the document for this new json function for both en and chinese docs.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 3, 2026

Deploying greptime-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b3e4bc
Status: ✅  Deploy successful!
Preview URL: https://65bc14be.greptime-docs.pages.dev
Branch Preview URL: https://copilot-update-json-path-mat.greptime-docs.pages.dev

View logs

Copilot AI changed the title [WIP] Update documentation for json_path_match UDF docs: add json_path_match function documentation (EN + ZH) Mar 3, 2026
@killme2008
Copy link
Copy Markdown
Member

@copilot

The result is 0 or 1:

mysql> SELECT json_path_match(parse_json('{"a": 1, "b": 2}'), '$.a == 1');
+------------------------------------------------------------------------+
| json_path_match(parse_json(Utf8("{"a": 1, "b": 2}")),Utf8("$.a == 1")) |
+------------------------------------------------------------------------+
|                                                                      1 |
+------------------------------------------------------------------------+
1 row in set (0.02 sec)

mysql> SELECT json_path_match(parse_json('{"a":1,"b":[1,2,3]}'), '$.b[1 to last] >= 2');
+--------------------------------------------------------------------------------------+
| json_path_match(parse_json(Utf8("{"a":1,"b":[1,2,3]}")),Utf8("$.b[1 to last] >= 2")) |
+--------------------------------------------------------------------------------------+
|                                                                                    1 |
+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT json_path_match(parse_json('{"a":1,"b":[1,2,3]}'), '$.b[0] > 1');
+-----------------------------------------------------------------------------+
| json_path_match(parse_json(Utf8("{"a":1,"b":[1,2,3]}")),Utf8("$.b[0] > 1")) |
+-----------------------------------------------------------------------------+
|                                                                           0 |
+-----------------------------------------------------------------------------+

And please sync the modification into v1.0.

Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot

The result is 0 or 1:
...

Fixed in 932d7cc — updated all SQL result outputs to show 1/0 instead of true/false, and added the json_path_match documentation to versioned_docs/version-1.0 as well.

Copilot AI changed the title docs: add json_path_match function documentation (EN + ZH) docs: add json_path_match function documentation (EN + ZH + v1.0) Mar 5, 2026
@killme2008
Copy link
Copy Markdown
Member

@copilot You fogot the chinese doc in v1.0

Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot You fogot the chinese doc in v1.0

Added in 3b3e4bcjson_path_match is now documented in i18n/zh/docusaurus-plugin-content-docs/version-1.0/reference/sql/functions/json.md.

Copy link
Copy Markdown
Member

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@killme2008 killme2008 requested review from sunng87 and v0y4g3r March 5, 2026 08:31
@killme2008 killme2008 marked this pull request as ready for review March 5, 2026 08:32
@killme2008 killme2008 requested a review from fengjiachun as a code owner March 5, 2026 08:32
Copy link
Copy Markdown
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

@fengjiachun fengjiachun merged commit bb5332d into main Mar 6, 2026
7 checks passed
@fengjiachun fengjiachun deleted the copilot/update-json-path-match-docs branch March 6, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update docs for feat: add json_path_match udf

4 participants