Improve generating and writing out changes in Merge #1854
Closed
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.
Note: This PR is based on #1851 and #1852 and includes the corresponding changes in the first two commits. Actual change can be seen starting from commit Improve writing changes out in Merge
This changes is part of a larger effort to improve merge performance, see #1827
Description
This change rewrites the way modified data is written out in merge to improve performance.
writeAllChanges
now generates a dataframe containing all the updated and copied rows to write out by building a large expression that selectively applies the right merge action to each row. This replaces the previous method that relied on applying a function to individual rows.Changes:
findTouchedFiles
andwriteAllchanges
to a dedicated new traitClassicMergeExecutor
implementing the regular merge path whenInsertOnlyMergeExecutor
is not used.MergeOutputGeneration
to transform the merge clauses into expressions that can be applied to generate the output of the merge operation (both main data and CDC data).How was this patch tested?
This change fully preserve the behavior of merge which is extensively tested in
MergeIntoSuiteBase
,MergeIntoSQLSuite
,MergeIntoScalaSuite
,MergeCDCSuite
,MergeIntoMetricsBase
,MergeIntoNotMatchedBySourceSuite
.