Skip to content

[kafka] Transcode mapped raw and string records to Arrow - #4285

Draft
gyang94 wants to merge 7 commits into
apache:mainfrom
gyang94:codex/kafka-raw-string-transcode
Draft

[kafka] Transcode mapped raw and string records to Arrow#4285
gyang94 wants to merge 7 commits into
apache:mainfrom
gyang94:codex/kafka-raw-string-transcode

Conversation

@gyang94

@gyang94 gyang94 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Closes #4282. Part of #4185.

Use the DDL mapping contract to decode raw/string keys and values, assemble physical rows with optional timestamps and ordered headers, and encode owned native Arrow log bytes.

This is PR06, depending on #4284 (PR05).

Brief change log

  • Raw bytes and strict UTF-8 strings map to the configured physical columns.
  • Nullable values, empty bytes, NOT NULL violations and duplicate/nullable headers are handled correctly.
  • The native batch uses the table schema ID and remains readable after Arrow resources close.
  • Arrow writers and allocators close on encoding failures.

Incremental scope: 6 files, +640 / -0 (314 implementation and 326 test lines). The implementation contract and its failure-path tests are kept together as one review unit; the line count includes Javadoc and license headers.

Tests

Java 11 at 503136295d6bbaed81b7e7845dceb2d64db2d9d4:

  • mvn -o -pl fluss-kafka spotless:apply clean verify: 75 unit tests and 2 integration tests passed.
  • Checkstyle, Spotless, RAT and git diff --check passed.
  • The two existing integration tests cover Kafka transport and native DDL mapping; this stage does not activate production Produce.

The full repository test suite and Flink SQL runtime were not run.

API and Format

Adds raw/string-to-Arrow conversion for the existing DDL contract, with no wire or storage format change. JSON decoding and append integration remain separate.

Stack and review

Draft while prerequisites are unmerged. The PR targets Apache main, so the full Files changed view includes prerequisites. Use this incremental comparison to review this stage alone.

Generative AI disclosure: Codex assisted with extraction, implementation, tests and commit organization. Human review is required before merge.

gyang94 and others added 7 commits September 9, 2026 14:04
Introduce API registration, request context, version validation, and
asynchronous error mapping. Fix request buffer ownership and response
serialization cleanup while preserving the existing ApiVersions entry point.

Validated with mvn -o -pl fluss-rpc,fluss-kafka verify.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 555/555
AI-Contributed/UT: 525/525
Route requests through the dispatcher and advertise only implemented APIs.
Return version-aware errors for unsupported APIs and invalid requests.

Validated with mvn -o -pl fluss-kafka verify (23 unit tests and 1 IT).

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 313/313
AI-Contributed/UT: 137/137
Add Metadata v0-v11 handling over pre-created Fluss tables, with listener-aware
gateway access, table/topic mapping, partition metadata, and error handling.
Do not implement CreateTopics, DeleteTopics, or automatic table creation.

Honor authoritative ISR values when bucket epochs are present. For legacy
metadata without an epoch, conservatively report only an available leader.

Verified fluss-kafka: 37 unit tests and 1 integration test, with Spotless and
Checkstyle passing. Rebuilt the matching RPC dependency from the same base.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 909/909
AI-Contributed/UT: 540/540
Extract topic identity and the raw/string table mapping contract before Metadata. Validate table kinds, field projections and metadata columns independently of request handling and record decoding.

Validation: Java 11, mvn -o -pl fluss-kafka clean verify (47 unit tests and 2 integration tests); Checkstyle, Spotless and RAT passed.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 769/769
AI-Contributed/UT: 480/480
Integrate the DDL mapping prerequisite and use its resolver for Metadata discovery. Omit unsupported tables from all-topic queries and return per-topic mapping errors for named queries. Preserve metadata for compatible tables in mixed requests.

Validation: Java 11, mvn -o -pl fluss-kafka clean verify (62 unit tests and 2 integration tests); Checkstyle, Spotless and RAT passed.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 742/742
AI-Contributed/UT: 571/571
Validate non-idempotent Produce v3-v11 and isolate invalid partitions before invoking a protocol-independent backend. Preserve partition order, acknowledgements and owned record data. Leave production registration to the append integration PR.

Validation: Java 11, mvn -o -pl fluss-kafka spotless:apply clean verify; 69 unit tests and 2 integration tests passed, including Checkstyle, Spotless and RAT.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 621/621
AI-Contributed/UT: 366/366
Reuse the DDL contract to assemble key, value, timestamp and ordered headers into physical rows. Decode strings with strict UTF-8 validation and preserve nullable values. Return owned heap log bytes and recycle Arrow writers on success and failure.

Validation: Java 11, mvn -o -pl fluss-kafka spotless:apply clean verify; 75 unit tests and 2 integration tests passed, including Checkstyle, Spotless and RAT.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 314/314
AI-Contributed/UT: 326/326
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.

[kafka] Transcode mapped raw and string records to Arrow

1 participant