Skip to content
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

Cache the computation of default columns during three-way merges. #7065

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions go/libraries/doltcore/merge/merge_prolly_rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ func mergeProllyTableData(ctx *sql.Context, tm *TableMerger, finalSch schema.Sch

keyless := schema.IsKeyless(tm.leftSch)

pri, err := newPrimaryMerger(leftEditor, tm, valueMerger, finalSch, mergeInfo)
defaults, err := resolveDefaults(ctx, tm.name, finalSch, tm.leftSch)
if err != nil {
return nil, nil, err
}

pri, err := newPrimaryMerger(leftEditor, tm, valueMerger, finalSch, mergeInfo, defaults)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -1044,15 +1049,17 @@ type primaryMerger struct {
tableMerger *TableMerger
finalSch schema.Schema
mergeInfo MergeInfo
defaults []sql.Expression
}

func newPrimaryMerger(leftEditor *prolly.MutableMap, tableMerger *TableMerger, valueMerger *valueMerger, finalSch schema.Schema, mergeInfo MergeInfo) (*primaryMerger, error) {
func newPrimaryMerger(leftEditor *prolly.MutableMap, tableMerger *TableMerger, valueMerger *valueMerger, finalSch schema.Schema, mergeInfo MergeInfo, defaults []sql.Expression) (*primaryMerger, error) {
return &primaryMerger{
mut: leftEditor,
valueMerger: valueMerger,
tableMerger: tableMerger,
finalSch: finalSch,
mergeInfo: mergeInfo,
defaults: defaults,
}, nil
}

Expand Down Expand Up @@ -1149,13 +1156,8 @@ func (m *primaryMerger) merge(ctx *sql.Context, diff tree.ThreeWayDiff, sourceSc
return fmt.Errorf("cannot merge keyless tables with reordered columns")
}
} else {
defaults, err := resolveDefaults(ctx, m.tableMerger.name, m.finalSch, m.tableMerger.leftSch)
if err != nil {
return err
}

tempTupleValue, err := remapTupleWithColumnDefaults(ctx, diff.Key, newTupleValue, sourceSch.GetValueDescriptor(),
m.valueMerger.leftMapping, m.tableMerger, m.tableMerger.leftSch, m.finalSch, defaults, m.valueMerger.syncPool, false)
m.valueMerger.leftMapping, m.tableMerger, m.tableMerger.leftSch, m.finalSch, m.defaults, m.valueMerger.syncPool, false)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/bats/performance-repo/.dolt/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5:__DOLT__:4t8rtld9ul7l137jac93phj1o6qinq6o:8ep2ilbq0lb461mqibkqp80nd0skdend:00000000000000000000000000000000:vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv:3722
Binary file not shown.
6 changes: 6 additions & 0 deletions integration-tests/bats/performance-repo/.dolt/repo_state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"head": "refs/heads/full",
"remotes": {},
"backups": {},
"branches": {}
}
Binary file not shown.
Loading
Loading