feat(core): add append-only/key-value file store write and compaction…#92
Open
lucasfang wants to merge 1 commit into
Open
feat(core): add append-only/key-value file store write and compaction…#92lucasfang wants to merge 1 commit into
lucasfang wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds core write-path implementations for append-only and key-value tables, and introduces compaction-related metrics with accompanying unit tests.
Changes:
- Introduces
AppendOnlyFileStoreWriteimplementation plus unit tests. - Introduces
KeyValueFileStoreWriteimplementation plus unit tests. - Adds
CompactionMetricsand unit tests for reporter aggregation, counters, and time window behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/paimon/core/operation/metrics/compaction_metrics.h |
New compaction metrics aggregator + per-partition/bucket reporters. |
src/paimon/core/operation/metrics/compaction_metrics_test.cpp |
Tests for compaction metrics aggregation, unregister behavior, and time windowing. |
src/paimon/core/operation/key_value_file_store_write.h |
Declares key-value table write implementation. |
src/paimon/core/operation/key_value_file_store_write.cpp |
Implements key-value writer creation, scan creation, and close logic. |
src/paimon/core/operation/key_value_file_store_write_test.cpp |
Tests write validation + spill/commit behaviors for key-value writer. |
src/paimon/core/operation/append_only_file_store_write.h |
Declares append-only table write implementation and compaction rewrite API. |
src/paimon/core/operation/append_only_file_store_write.cpp |
Implements append-only write + compaction rewrite flow and readers/writers creation. |
src/paimon/core/operation/append_only_file_store_write_test.cpp |
Tests write validation and max sequence number scanning for append-only writer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+26
to
+28
| #include "paimon/core/mergetree/compact/merge_function_wrapper.h" | ||
| #include "paimon/core/mergetree/compact/merge_tree_compact_manager_factory.h" | ||
| #include "paimon/core/operation/abstract_file_store_write.h" |
Comment on lines
+33
to
+37
| #include "paimon/core/deletionvectors/deletion_vector.h" | ||
| #include "paimon/core/io/single_file_writer.h" | ||
| #include "paimon/core/operation/abstract_file_store_write.h" | ||
| #include "paimon/core/table/bucket_mode.h" | ||
| #include "paimon/file_store_write.h" |
Comment on lines
+27
to
+29
| #include "paimon/core/mergetree/compact/merge_tree_compact_manager_factory.h" | ||
| #include "paimon/core/operation/abstract_file_store_write.h" | ||
| #include "paimon/core/utils/batch_writer.h" |
Comment on lines
+233
to
+235
| PAIMON_RETURN_NOT_OK_FROM_ARROW(arrow::ExportSchema(*schema, &arrow_schema)); | ||
| PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatStatsExtractor> stats_extractor, | ||
| format->CreateStatsExtractor(&arrow_schema)); |
| ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish()); | ||
| ASSERT_OK_AND_ASSIGN(auto file_store_write, | ||
| FileStoreWrite::Create(std::move(write_context))); | ||
| auto array = std::make_shared<arrow::Array>(); |
| ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish()); | ||
| ASSERT_OK_AND_ASSIGN(auto file_store_write, | ||
| FileStoreWrite::Create(std::move(write_context))); | ||
| auto array = std::make_shared<arrow::Array>(); |
| ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish()); | ||
| ASSERT_OK_AND_ASSIGN(auto file_store_write, | ||
| FileStoreWrite::Create(std::move(write_context))); | ||
| auto array = std::make_shared<arrow::Array>(); |
Comment on lines
+54
to
+56
| void ReportLevel0FileCount(int64_t count) { | ||
| level0_file_count_ = count; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: No linked issue
This change adds file store write operations and compaction metrics support for the core operation module.
Included changes:
Append-only file store write:
append_only_file_store_write.hand.cppimplementing append-only table write logic.append_only_file_store_write_test.cpp.Key-value file store write:
key_value_file_store_write.hand.cppimplementing key-value table write logic.key_value_file_store_write_test.cpp.Compaction metrics:
metrics/compaction_metrics.hdefining compaction-related metric instruments.metrics/compaction_metrics_test.cpp.Tests
Test coverage included in this change:
AppendOnlyFileStoreWriteTestKeyValueFileStoreWriteTestCompactionMetricsTestLocal compile, CMake, and gtest environment checks are not part of this PR description.
API and Format
No public API, storage format, or protocol changes.
Documentation
No documentation changes required.
Generative AI tooling
Migrate-by: Aone Copilot (Qwen-3.7-Max)