Skip to content

perf(read): reduce Arrow read-path overhead - #242

Merged
lxy-9602 merged 4 commits into
apache:mainfrom
gripleaf:fix-perf-v0
Aug 25, 2026
Merged

perf(read): reduce Arrow read-path overhead#242
lxy-9602 merged 4 commits into
apache:mainfrom
gripleaf:fix-perf-v0

Conversation

@gripleaf

@gripleaf gripleaf commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: #240

Reduce avoidable CPU and memory-management overhead in the Avro and manifest read paths:

  • Skip the redundant recursive Arrow array validation in release builds while retaining it in debug builds.
  • Reuse a single ColumnarRow when scanning rows in the same manifest batch, updating only its row index.
  • Reserve Avro Builder capacity based on the configured batch size.
  • Reserve List and Map child Builder capacity using decoded Avro block sizes, including nested Struct builders.

These changes reduce repeated type fingerprint calculation, row-view construction and destruction, memory reallocations, and data copying.

Tests

  • paimon-avro-format-test: 68 tests passed.
  • ManifestFileTest.*: 8 tests passed.
  • ColumnarRowTest.TestSimple: passed.
  • Added coverage for:
    • Reusing ColumnarRow across different row indexes.
    • Recursive capacity reservation for Struct builders.
    • Correct capacity handling for nested List builders.
  • pre-commit run --files <changed-files>: passed.
  • git diff --check: passed.

API and Format

No public API changes under include/paimon/.

No storage format or protocol changes.

Documentation

No documentation changes. This is an internal performance optimization and does not introduce new user-facing functionality.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-5)

@gripleaf

Copy link
Copy Markdown
Contributor Author

Flame graph comparison

The following flame graphs were collected using the same workload and profiling configuration.

Before optimization:
image

After optimization:
image

Comment thread src/paimon/format/avro/avro_direct_decoder.h
Comment thread src/paimon/format/avro/avro_file_batch_reader.cpp
Comment thread src/paimon/format/avro/avro_direct_decoder.cpp
@gripleaf gripleaf changed the title perf: reduce Arrow read-path overhead perf(read): reduce Arrow read-path overhead Aug 24, 2026
@lxy-9602
lxy-9602 requested a review from zjw1111 August 24, 2026 12:38

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

Thanks for working on the read-path overhead here — the ColumnarRow reuse and the builder capacity reservation both look like the right direction, and I verified the row-reuse change is safe.

Two points I'd like to raise before this lands, left inline.

Comment thread src/paimon/format/avro/avro_file_batch_reader.cpp Outdated
Comment thread src/paimon/core/manifest/manifest_file.cpp
Avoid redundant Arrow array validation in release builds, reuse ColumnarRow views while scanning manifest batches, and reserve Avro builder capacity ahead of decoding.
Place the mutable builder parameter last and express debug-only array validation with assert.

@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

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

+1

@lxy-9602
lxy-9602 merged commit 7d992ca into apache:main Aug 25, 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.

3 participants