Add dolt_preview_merge_conflicts table function#9270
Conversation
dolt_preview_merge_conflicts table function
reltuk
left a comment
There was a problem hiding this comment.
Some quick comments on the implementation. I think I got enough of an overview to discuss further iteration...
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts_summary.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
874c15a to
7507de1
Compare
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
c0ee319 to
eec403b
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the new table function dolt_preview_merge_conflicts along with extensive tests and refactors conflict table schema handling. Key changes include:
- New test cases for dolt_preview_merge_conflicts and its error conditions in multiple query test files.
- Renaming and refactoring of functions (e.g. CalculateConflictSchema) with updated conflict row handling using new descriptors and offsets.
- Minor adjustments and improvements in downstream merge logic and functionality.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| go/libraries/doltcore/sqle/enginetest/dolt_queries_schema_merge.go | Added test cases for preview merge conflicts with expected error strings. |
| go/libraries/doltcore/sqle/enginetest/dolt_queries_merge.go | Expanded test coverage for various preview merge conflicts scenarios. |
| go/libraries/doltcore/sqle/dtables/conflicts_tables_prolly.go | Refactored conflict schema calculation and row iteration using new value descriptors and offsets. |
| go/libraries/doltcore/sqle/dtablefunctions/init.go | Registered the new PreviewMergeConflictsTableFunction. |
| go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts_summary.go | Updated branch-to-root resolution to use a new rootInfo struct. |
| go/libraries/doltcore/dtablefunctions/dolt_diff.go | Corrected error message formatting. |
| go/libraries/doltcore/merge/* | Added helper method and streamlined merge logic with new getters. |
Comments suppressed due to low confidence (3)
go/libraries/doltcore/sqle/dtables/conflicts_tables_prolly.go:56
- The function name has been updated to 'CalculateConflictSchema' (exported), so please verify that all callers across the codebase have been updated to reflect this naming change.
confSch, versionMappings, err := CalculateConflictSchema(baseSch, ourSch, theirSch)
go/libraries/doltcore/sqle/dtables/conflicts_tables_prolly.go:256
- [nitpick] Consider adding inline comments or expanding the function's documentation to explain how the various offset values are computed and used when populating conflict rows. This would improve readability and ease future maintenance.
func PutConflictRowVals(ctx *sql.Context, confVal ConflictVal, row sql.Row, offsets ConflictOffsets, vds ConflictValueDescriptors, ns tree.NodeStore) error {
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts_summary.go:299
- [nitpick] Now that the function returns a 'rootInfo' struct with additional fields (rightCm and ancCm), it would be beneficial to enhance the documentation for this function, explaining the purpose of each field and the expected usage downstream.
func resolveBranchesToRoots(ctx *sql.Context, db dsess.SqlDatabase, leftBranch, rightBranch string) (rootInfo, error) {
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Show resolved
Hide resolved
nicktobey
left a comment
There was a problem hiding this comment.
Alright this looks good. I just have a couple points of confusion that I think can be cleared up with comments.
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
go/libraries/doltcore/sqle/dtablefunctions/dolt_preview_merge_conflicts.go
Outdated
Show resolved
Hide resolved
|
@tbantle22 DOLT
|
|
@coffeegoddd DOLT
|
|
@tbantle22 DOLT
|
This table function shows which rows are conflicting for a table between two branches. Will error if there are schema conflicts