Skip to content

feat(realtime): support external offsets and shredding-aware reads - #269

Merged
SteNicholas merged 13 commits into
apache:mainfrom
lxy-9602:refactor-rt
Sep 4, 2026
Merged

feat(realtime): support external offsets and shredding-aware reads#269
SteNicholas merged 13 commits into
apache:mainfrom
lxy-9602:refactor-rt

Conversation

@lxy-9602

@lxy-9602 lxy-9602 commented Aug 31, 2026

Copy link
Copy Markdown
Member

Purpose

Linked issue: #158

This change improves realtime writes and reads.

For realtime-enabled writes, external engines must provide a leading non-nullable INT64 _REALTIME_OFFSET:

[_REALTIME_OFFSET, table write fields...]

Offsets must be strictly increasing for each partition-bucket, but gaps are allowed. Paimon persists the exclusive committed offset in the snapshot offset file for WAL recovery. _REALTIME_OFFSET is not written into data files.

Because offsets may be sparse, OffsetRange remains left-closed and right-open but no longer represents the row count.

This PR also moves offset filtering and physical-to-logical conversion into a shared Paimon read pipeline for append-only and primary-key tables. It supports consistent disk and realtime-memory reads for:

  • selected-key and shared-shredding MAP access;
  • nested projections;
  • shredded VARIANT access and binary fallback.

Tests

Added or updated coverage for:

  • external and sparse realtime offsets;
  • invalid, duplicate, backward, and overflowing offsets;
  • commit progress, snapshot offsets, and recovery;
  • exact row counting with sparse offsets;
  • append-only and primary-key realtime reads;
  • MAP and VARIANT projections across disk and memory.

API and Format

Realtime write input and RealtimeStore APIs are updated to support external offsets and shared read processing.
Data-file and snapshot offset-file formats are unchanged.

Documentation

Generative AI tooling

Generated-by: OpenAI Codex (GPT-5)

@lxy-9602 lxy-9602 changed the title refactor(realtime): move offset handling to Paimon readers feat(realtime): support shredding-aware realtime reads & refactor rt read Sep 1, 2026
@lxy-9602 lxy-9602 changed the title feat(realtime): support shredding-aware realtime reads & refactor rt read feat(realtime): support external offsets and shredding-aware reads Sep 1, 2026
Comment thread src/paimon/core/operation/commit/realtime_commit_properties.cpp
Comment thread src/paimon/core/realtime/realtime_primary_key_writer.cpp
Comment thread src/paimon/core/io/key_value_data_file_record_reader.cpp
Comment thread src/paimon/core/realtime/realtime_primary_key_reader.cpp
Comment thread include/paimon/realtime/offset_range.h Outdated
Comment thread include/paimon/realtime/realtime_store.h Outdated
Comment thread src/paimon/core/realtime/realtime_primary_key_reader.cpp
Comment thread src/paimon/core/realtime/realtime_offset_utils.h
Comment thread test/inte/realtime_write_inte_test.cpp Outdated

@zjw1111 zjw1111 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1

Comment thread src/paimon/core/realtime/realtime_primary_key_writer.cpp
Comment thread src/paimon/core/realtime/realtime_offset_batch_reader.cpp
Comment thread src/paimon/core/realtime/realtime_offset_batch_reader.cpp

@SteNicholas SteNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@SteNicholas
SteNicholas merged commit f26b62c into apache:main Sep 4, 2026
16 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.

5 participants