docs: json2 data type#2615
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR adds documentation for GreptimeDB’s JSON2 data type (nightly/current docs) and surfaces it in the Logs section of the docs sidebar, including a Chinese localized version.
Changes:
- Added a new JSON2 documentation page under
docs/user-guide/logs/. - Added the corresponding Chinese doc under
i18n/zh/.../current/. - Linked the new page into the Logs sidebar navigation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sidebars.ts | Adds the new user-guide/logs/json2 doc entry to the Logs sidebar. |
| docs/user-guide/logs/json2.md | Introduces the English JSON2 type guide with examples and limitations. |
| i18n/zh/docusaurus-plugin-content-docs/current/user-guide/logs/json2.md | Adds the Chinese version of the JSON2 type guide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb656f1549
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| When creating a table, you can declare a JSON2 column with the `JSON2` type. | ||
| Currently, JSON2 can only be used in append-only tables, so you must set `'append_mode' = 'true'` when creating the table. | ||
|
|
||
| JSON2 supports type hints, which let you declare concrete data types for subpaths. Once declared, these subpaths are stored using the specified types, which provides query performance close to regular columns and enforces type validation during writes. In the following example, the `attrs` column defines type hints for common paths such as `http.status`, `latency_ms`, and `error`. |
There was a problem hiding this comment.
describe this is not required. My suggestion is to make quick start quick enough and cover type hint in later section.
just show how to create table without type hint, ingest json and query.
| - Support subscript access to elements inside JSON arrays. For now, you can query `attrs.items`, but not `attrs.items[0]` or `json_get(attrs, 'items[0]')`. | ||
| - Support functions such as `json_get_string`, `json_get_int`, `json_get_float`, and `json_get_bool` for JSON2. | ||
| - Extend supported type hint data types, such as time-related types like `TIMESTAMP`. | ||
| - Support index options such as `INVERTED INDEX` and `SKIPPING INDEX` for type hints. |
There was a problem hiding this comment.
how to use json2 with otlp and other ingestion path
|
|
||
| Type hints allow `NULL` by default. If you specify `NOT NULL`, that path must exist in the written JSON. | ||
|
|
||
| ### `json_get` |
There was a problem hiding this comment.
| ### `json_get` | |
| ### `json_get` UDF |
|
|
||
| ```sql | ||
| json_get(json_column, 'path.to.field')::TYPE | ||
| ``` |
There was a problem hiding this comment.
add a description for dot syntax
|
|
||
| ## Syntax | ||
|
|
||
| ### Type hints |
There was a problem hiding this comment.
| ### Type hints | |
| ### JSON Field Type hints |
There was a problem hiding this comment.
and explain why it's essential, but optional
What's Changed in this PR
This PR adds a guide to JSON2, including a quick start, syntax, and future roadmap.
Checklist
sidebars.tsmatches the current document structure when you changed the document structure.