Skip to content

feat: support JSON2 row writes - #111

Merged
MichaelScofield merged 1 commit into
mainfrom
feat/json2-write
Sep 17, 2026
Merged

MichaelScofield merged 1 commit into
mainfrom
feat/json2-write

Conversation

@MichaelScofield

Copy link
Copy Markdown
Contributor

Adds JSON2 ingestion through DataType.Json2, matching the Rust client’s native Protobuf encoding and schema metadata. JSON objects (including nested arrays and scalars) are accepted, top-level JSON null becomes SQL NULL, and invalid input is rejected before sending. The schema metadata supports automatic JSON2 table creation even when the first write contains only NULL.

  • Upgrade greptimedb-proto to 0.16.0 and the CI integration server to GreptimeDB 1.2.1, including its renamed gRPC bind flag.
  • Add a standalone Json2WriteQuickStart example using append_mode=true, plus encoding and JDBC round-trip coverage.
  • Preserve existing JSON encoding and explicitly reject JSON2 in Bulk/Arrow writes.
  • Validate decimal extensions before changing the schema builder, consistently across all data types.

Validation:

  • Full Maven verification against official GreptimeDB 1.2.1 passed, including all 8 integration tests. Local JDK required -DargLine=--add-opens=java.base/java.nio=ALL-UNNAMED for Arrow.
  • JSON2 integration coverage checks NULL-first auto-creation, nested data, changing field types, empty objects, JSON null, query results, and the JSON2 column type.
  • TableSchemaTest and Json2Test passed after the final schema validation change.
  • The example successfully inserted 5 rows against GreptimeDB 1.2.1.
  • Repository-wide Spotless check and git diff --check passed.

Signed-off-by: luofucong <luofc@foxmail.com>
@MichaelScofield
MichaelScofield requested review from fengjiachun and a lite review from Copilot September 17, 2026 10:47
@MichaelScofield

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-17T10:51:28.655396Z 879968e Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 879968eddd

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Empty or whitespace-only JSON2 input is accepted as SQL NULL and must be rejected.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds native JSON2 ingestion for row writes, including Protobuf encoding, schema metadata, validation, tests, and a quickstart example.

Changes:

  • Adds JSON2 parsing, encoding, and schema support.
  • Rejects JSON2 in bulk/Arrow writes while preserving legacy JSON.
  • Updates dependencies, CI, integration coverage, and documentation example.
File summaries
File Summary
ingester-protocol/src/test/java/io/greptime/models/TableSchemaTest.java Tests schema validation.
ingester-protocol/src/test/java/io/greptime/models/Json2Test.java Tests JSON2 encoding and invalid input handling.
ingester-protocol/src/main/java/io/greptime/models/ValueUtil.java Parses and encodes JSON2 values.
ingester-protocol/src/main/java/io/greptime/models/TableSchema.java Adds JSON2 schema metadata and validation.
ingester-protocol/src/main/java/io/greptime/models/Table.java Supports JSON2 column options.
ingester-protocol/src/main/java/io/greptime/models/RowHelper.java Routes JSON2 row values.
ingester-protocol/src/main/java/io/greptime/models/DataType.java Adds the Json2 data type.
ingester-protocol/src/main/java/io/greptime/models/ArrowHelper.java Rejects JSON2 bulk writes.
ingester-protocol/pom.xml Upgrades the protobuf dependency.
ingester-integration-tests/src/test/java/io/greptime/RegularWriteIT.java Adds JSON2 integration coverage.
ingester-example/src/main/java/io/greptime/quickstart/write/Json2WriteQuickStart.java Adds a JSON2 quickstart example.
.github/workflows/build.yml Updates GreptimeDB CI configuration.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ingester-protocol/src/main/java/io/greptime/models/ValueUtil.java

@fengjiachun fengjiachun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MichaelScofield
MichaelScofield merged commit 05c018d into main Sep 17, 2026
7 checks passed
@MichaelScofield
MichaelScofield deleted the feat/json2-write branch September 17, 2026 11:35
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.

3 participants