-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Support iceberg partition transform #15035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
PingLiuPing
wants to merge
1
commit into
facebookincubator:main
from
PingLiuPing:lp_iceberg_basic_insertion_02
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -530,7 +530,10 @@ class HiveDataSink : public DataSink { | |
| CommitStrategy commitStrategy, | ||
| const std::shared_ptr<const HiveConfig>& hiveConfig, | ||
| uint32_t bucketCount, | ||
| std::unique_ptr<core::PartitionFunction> bucketFunction); | ||
| std::unique_ptr<core::PartitionFunction> bucketFunction, | ||
| const std::vector<column_index_t>& partitionChannels, | ||
| const std::vector<column_index_t>& dataChannels, | ||
| std::unique_ptr<PartitionIdGenerator> partitionIdGenerator); | ||
|
|
||
| void appendData(RowVectorPtr input) override; | ||
|
|
||
|
|
@@ -631,7 +634,7 @@ class HiveDataSink : public DataSink { | |
| // to each corresponding (bucketed) partition based on the partition and | ||
| // bucket ids calculated by 'computePartitionAndBucketIds'. The function also | ||
| // ensures that there is a writer created for each (bucketed) partition. | ||
| void splitInputRowsAndEnsureWriters(); | ||
| virtual void splitInputRowsAndEnsureWriters(const RowVectorPtr& input); | ||
|
|
||
| // Makes sure to create one writer for the given writer id. The function | ||
| // returns the corresponding index in 'writers_'. | ||
|
|
@@ -641,10 +644,37 @@ class HiveDataSink : public DataSink { | |
| // the newly created writer in 'writers_'. | ||
| uint32_t appendWriter(const HiveWriterId& id); | ||
|
|
||
| // Creates and configures WriterOptions based on file format. | ||
| // Sets up compression, schema, and other writer configuration based on the | ||
| // insert table handle and connector settings. | ||
| virtual std::shared_ptr<dwio::common::WriterOptions> createWriterOptions() | ||
| const; | ||
|
|
||
| std::unique_ptr<facebook::velox::dwio::common::Writer> | ||
| maybeCreateBucketSortWriter( | ||
| std::unique_ptr<facebook::velox::dwio::common::Writer> writer); | ||
|
|
||
| // Constructs the full partition directory path by combining the table | ||
| // directory with an optional partition subdirectory. If partitionSubdirectory | ||
| // is provided, returns tableDirectory/partitionSubdirectory; otherwise, | ||
| // returns tableDirectory unchanged (for non-partitioned tables). | ||
| std::string makePartitionDirectory( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| const std::string& tableDirectory, | ||
| const std::optional<std::string>& partitionSubdirectory) const; | ||
|
|
||
| // Records a row index for a specific partition. This method maintains the | ||
| // mapping of which input rows belong to which partition by storing row | ||
| // indices in partition-specific buffers. If the buffer for the partition | ||
| // doesn't exist or is too small, it allocates/reallocates the buffer to | ||
| // accommodate all rows. | ||
| void | ||
| updatePartitionRows(uint32_t index, vector_size_t numRows, vector_size_t row); | ||
|
|
||
| // Allocates buffer space for a new partition by extending the partition | ||
| // tracking vectors. This is called when a new writer is created for a | ||
| // partition to ensure there's space to track row indices for that partition. | ||
| void reservePartitionBuffers(); | ||
|
|
||
| HiveWriterParameters getWriterParameters( | ||
| const std::optional<std::string>& partition, | ||
| std::optional<uint32_t> bucketId) const; | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment for all the public functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.