Skip to content

feat(blob): read Paimon video files - #601

Open
XiaoHongbo-Hope wants to merge 9 commits into
apache:mainfrom
XiaoHongbo-Hope:codex/video-read-support
Open

XiaoHongbo-Hope wants to merge 9 commits into
apache:mainfrom
XiaoHongbo-Hope:codex/video-read-support

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: none.

Read scalar BLOB columns stored in Paimon .video files using the six-index footer written by the Java Paimon writer. Map selected table rows to lazy frame descriptors and use the BLOB fallback path for placeholders in partial updates. Java format change

Tests

Cover sparse and empty selections, Arrow batch lifetime, and malformed footers and MP4 metadata. Check the descriptor encoding and decoding against fixtures from Java Paimon. Exercise overlapping video layers through TableRead with placeholder fallback, explicit NULL, and _ROW_ID projection. Cover rejection of frame descriptors in the ordinary BLOB writer and writes to configured video fields.

API and Format

Blob::FromDescriptor() opens the Java-compatible frame descriptor and exposes its frame ordinal and optional MP4 moov range. The frame metadata uses an internal type, preserving the public BlobDescriptor layout and its serialization. Video reads emit frame descriptors even when blob-as-descriptor=false.

Documentation

Document how to access the encoded payload, the supported 29-byte footer, and the need to reimport files with the earlier five-index footer.

Generative AI tooling

Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)

Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)

@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.

@XiaoHongbo-Hope, thanks for contribution. I left some comments for this pull request. PTAL.

}
PAIMON_ASSIGN_OR_RAISE(int64_t magic, in.ReadValue<int64_t>());
return kMagic == magic;
return kMagic == magic || (version == kVideoFrameVersion && kVideoFrameMagic == magic);

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.

Prevent .blob writes from silently dropping frame identity. BlobFormatWriter::OpenBlobInputStream() uses this predicate to decide whether to dereference a value. I appended descriptors for frames 7 and 8 of the same payload to a video-frame-field table through FileStoreWrite. The commit succeeded with a .blob file, and both rows came back as ordinary blobs with FrameIndex() == -1. The append path selects the ordinary blob writer before the read-only video format can reject the write. Please reject frame descriptors at that writer boundary and guard writes to configured video fields until a frame-preserving writer is available.

Comment thread include/paimon/data/blob_descriptor.h Outdated
std::string uri_;
int64_t offset_ = 0;
int64_t length_ = -1;
int64_t frame_index_ = -1;

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.

Treat the BlobDescriptor layout change as a public ABI change. On arm64, the exported type grows from 48 to 72 bytes. Its public implicit copy constructor lets a client compiled with the previous header place a copy in 48 bytes of client-owned storage. The updated Serialize() can then read frame_index_ beyond that storage. Please preserve the old layout by keeping video state in a separate representation, or mark this change as breaking and document that existing clients must rebuild.

{4, 0, 9}};
std::vector<uint32_t> sizes;
for (const auto& values : indexes) {
const auto bytes = DeltaVarintCompressor::Compress(values);

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.

Add an independent Java fixture and exercise it through TableRead. The fixture here uses the C++ Delta-Varint encoder, and the tests open the format reader directly. A wire-format mistake shared by the test and reader could pass, and the table-level wiring for grouping and placeholder fallback is currently untested. The Java video-v1-moov.hex and video-frame-descriptor-v1.hex fixtures can cover both directions of the descriptor round trip. Please also cover a managed split with Parquet and overlapping .video layers, including a placeholder that falls through to an older frame, an explicit NULL, and _ROW_ID projection. Java fixtures and format change

Comment thread docs/source/user_guide/read.rst Outdated
Reading Video Columns
---------------------

Paimon C++ can read scalar BLOB columns stored in Paimon v1 ``.video`` files.

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.

Document the supported six-index layout and the reimport requirement. Apache Paimon reused version 1 when it replaced the five-index footer with the 29-byte, six-index footer. Users with files written before that change need to reimport them before using this reader. Please also state explicitly that .video columns emit frame descriptors even when blob-as-descriptor=false. Upstream layout change

Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review November 28, 2026 07:29
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)
Generated-by: OpenAI Codex CLI 0.172.0 (GPT-6.2 Sol)

This branch has not been deployed

No deployments
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.

2 participants