Skip to content

[core] Unify manifest Avro readers - #9182

Merged
JingsongLi merged 13 commits into
apache:masterfrom
leaves12138:codex/manifest-avro-reader
Aug 12, 2026
Merged

[core] Unify manifest Avro readers#9182
JingsongLi merged 13 commits into
apache:masterfrom
leaves12138:codex/manifest-avro-reader

Conversation

@leaves12138

Copy link
Copy Markdown
Contributor

Purpose

Unify projected manifest decoding and raw Avro block access in ManifestAvroReader so callers can use one reusable, low-allocation reader path.

Changes

  • expose borrowed compressed Avro blocks and lazily decompress them
  • decode projected manifest rows without materializing ManifestEntry POJOs
  • reuse row objects, borrowed byte views, and the decompression buffer across blocks
  • preserve raw encoded records for downstream streaming consumers
  • route normal manifest scans through the unified reader
  • include FIRST_ROW_ID in the delete-entry projection

This PR intentionally does not include manifest run-merge sorting, external-sort changes, writer changes, or related configuration. Those will be split into follow-up PRs.

Tests

  • mvn -pl paimon-format -am -Pfast-build -DfailIfNoTests=false -Dtest=AvroFileFormatTest test
  • mvn -pl paimon-core -am -Pfast-build -DfailIfNoTests=false -Dtest=ManifestFileTest test
  • mvn -pl paimon-core -am -Pfast-build -DfailIfNoTests=false -Dtest=ProjectedManifestEntryTest test
  • mvn -pl paimon-common,paimon-format,paimon-core spotless:check

@leaves12138
leaves12138 marked this pull request as ready for review August 11, 2026 17:18
return new RowAvroWriterFactory(type);
}

public Schema createAvroSchema(RowType rowType) {

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.

Do not rely on AvroFileFormat. Manifest reader should be a separate path.


private static class ManifestRecordDecoder {
/** Reusable {@link GenericRow} with borrowed views over fields in the current Avro block. */
public static final class BlockRow extends GenericRow {

@JingsongLi JingsongLi Aug 12, 2026

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.

Do not extends GenericRow, a little performance affect to it. And this class should be a generic class, which optimize binary for reusing bytes buffer.

@@ -85,15 +96,42 @@ public byte[] nextBlock() throws IOException {
* {@link #hasNextBlock()}, {@link #nextBlock()}, or this method, or when this reader is closed.
*/
public BorrowedBlock nextBorrowedBlock() throws IOException {

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.

Remove this method.


private static class ManifestRecordDecoder {
/** Reusable {@link GenericRow} with borrowed views over fields in the current Avro block. */
public static final class BlockRow extends GenericRow {

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.

This path is only for full projection.

@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit f2a59c2 into apache:master Aug 12, 2026
12 of 13 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.

2 participants