Skip to content

feat: support Flight auto-create table metadata and hint - #110

Merged
v0y4g3r merged 6 commits into
mainfrom
feat/auto-create-table-hint
Aug 18, 2026
Merged

feat: support Flight auto-create table metadata and hint#110
v0y4g3r merged 6 commits into
mainfrom
feat/auto-create-table-hint

Conversation

@v0y4g3r

@v0y4g3r v0y4g3r commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What changed

Align the Java bulk (Arrow Flight) write path with the current contract in GreptimeTeam/greptimedb-enterprise#845 (server head 9b277b5b):

  • Every Arrow field carries greptime:semantic_type with value tag, field, or timestamp.
  • The timestamp field is non-nullable and identifies the unique time index.
  • JSON fields additionally carry greptime:type=Json, preserving the extended type during automatic table creation.
  • Context.withAutoCreateTable(boolean) provides a typed request-level auto_create_table hint. It is encoded through the existing x-greptime-hints header path used by Flight writes.

The request hint follows server semantics: the server global auto-create option remains the upper bound; an explicit false disables automatic creation for that request. Existing-table schema alignment remains available regardless of this hint.

The row-based write path already sends semantic types through proto ColumnSchema.semantic_type and is unchanged.

Verification

  • mvn test
  • mvn spotless:check
  • git diff --check

Related

  • GreptimeTeam/greptimedb-enterprise#845

…bulk write

Attach GreptimeDB field metadata to the Arrow schema sent on the bulk
(Flight) write path so the server can auto-create missing tables:

- timestamp column: greptime:time_index=true, marked non-nullable
- tag/field columns: greptime:semantic_type=tag|field
- JSON columns: greptime:type=Json

This matches the server-side contract introduced in
GreptimeTeam/greptimedb-enterprise#845.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Copilot AI review requested due to automatic review settings August 1, 2026 14:40

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.

Pull request overview

This PR updates the bulk (Arrow Flight) write path to embed TableSchema semantic types into Arrow Field metadata, enabling GreptimeDB to auto-create missing tables correctly during bulk inserts (including time index handling and JSON column typing).

Changes:

  • Encode column semantic types into Arrow field metadata (greptime:time_index, greptime:semantic_type, greptime:type) when building the Arrow Schema.
  • Make the time index (timestamp semantic type) field non-nullable in the Arrow schema.
  • Add a unit test validating the emitted metadata and nullability behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ingester-protocol/src/main/java/io/greptime/models/ArrowHelper.java Adds public metadata key constants and writes semantic-type/data-type metadata into Arrow FieldType during schema construction.
ingester-protocol/src/test/java/io/greptime/models/ArrowHelperTest.java Adds a unit test asserting semantic metadata and nullability for tag/timestamp/field/JSON columns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ingester-protocol/src/main/java/io/greptime/models/ArrowHelper.java Outdated
v0y4g3r added 2 commits August 1, 2026 23:48
Unify on a single metadata key: every column now carries
greptime:semantic_type with value tag, field or timestamp, instead of
marking the time index with a separate greptime:time_index=true key.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
@v0y4g3r v0y4g3r changed the title feat: propagate column semantic types into Arrow schema metadata for bulk write feat: support Flight auto-create table metadata and hint Aug 5, 2026

@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. A few small comments inline, none blocking.

Comment thread ingester-protocol/src/main/java/io/greptime/models/ArrowHelper.java
Comment thread ingester-protocol/src/main/java/io/greptime/models/ArrowHelper.java Outdated
Comment thread ingester-rpc/src/main/java/io/greptime/rpc/Context.java Outdated
Comment thread ingester-rpc/src/main/java/io/greptime/rpc/Context.java
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
@v0y4g3r
v0y4g3r merged commit 1b061a4 into main Aug 18, 2026
11 of 12 checks passed
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