Skip to content

Commit

Permalink
Merge pull request #8083 from dolthub/nicktobey-9e5cc178
Browse files Browse the repository at this point in the history
[auto-bump] [no-release-notes] dependency by nicktobey
  • Loading branch information
nicktobey authored Jun 27, 2024
2 parents 605b4de + dbab93c commit 861b779
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/cespare/xxhash v1.1.0
github.com/creasty/defaults v1.6.0
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
github.com/dolthub/go-mysql-server v0.18.2-0.20240626180128-807a2e35937f
github.com/dolthub/go-mysql-server v0.18.2-0.20240627195919-9e5cc178ea5e
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63
github.com/dolthub/swiss v0.1.0
github.com/goccy/go-json v0.10.2
Expand Down
4 changes: 2 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y=
github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168=
github.com/dolthub/go-mysql-server v0.18.2-0.20240626180128-807a2e35937f h1:ouZxORcShC3qeQdsTkKDpROh+OI1OZuoOAJx8HThMrs=
github.com/dolthub/go-mysql-server v0.18.2-0.20240626180128-807a2e35937f/go.mod h1:JahRYjx/Py6T/bWrnTu25CaGn94Df+McAuWGEG0shwU=
github.com/dolthub/go-mysql-server v0.18.2-0.20240627195919-9e5cc178ea5e h1:fceuWLzXexYucAJYtxGnxGomH1swGD3qXjz1P71SKk8=
github.com/dolthub/go-mysql-server v0.18.2-0.20240627195919-9e5cc178ea5e/go.mod h1:JahRYjx/Py6T/bWrnTu25CaGn94Df+McAuWGEG0shwU=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q=
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514=
Expand Down
8 changes: 4 additions & 4 deletions go/libraries/doltcore/merge/merge_prolly_rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ func (m *valueMerger) mergeJSONAddr(ctx context.Context, baseAddr []byte, leftAd
return nil, true, err
}

mergedDoc, conflict, err := mergeJSON(baseDoc, leftDoc, rightDoc)
mergedDoc, conflict, err := mergeJSON(ctx, baseDoc, leftDoc, rightDoc)
if err != nil {
return nil, true, err
}
Expand All @@ -2015,7 +2015,7 @@ func (m *valueMerger) mergeJSONAddr(ctx context.Context, baseAddr []byte, leftAd

}

func mergeJSON(base types.JSONDocument, left types.JSONDocument, right types.JSONDocument) (resultDoc types.JSONDocument, conflict bool, err error) {
func mergeJSON(ctx context.Context, base types.JSONDocument, left types.JSONDocument, right types.JSONDocument) (resultDoc types.JSONDocument, conflict bool, err error) {
// First, deserialize each value into JSON.
// We can only merge if the value at all three commits is a JSON object.

Expand Down Expand Up @@ -2046,7 +2046,7 @@ func mergeJSON(base types.JSONDocument, left types.JSONDocument, right types.JSO

// Compute the merged object by applying diffs to the left object as needed.
for {
threeWayDiff, err := threeWayDiffer.Next()
threeWayDiff, err := threeWayDiffer.Next(ctx)
if err == io.EOF {
return merged, false, nil
}
Expand All @@ -2058,7 +2058,7 @@ func mergeJSON(base types.JSONDocument, left types.JSONDocument, right types.JSO
return types.JSONDocument{}, true, err
}
case tree.DiffOpRightDelete, tree.DiffOpConvergentDelete:
_, _, err := merged.Remove(threeWayDiff.Key)
_, _, err := merged.Remove(ctx, threeWayDiff.Key)
if err != nil {
return types.JSONDocument{}, true, err
}
Expand Down
5 changes: 3 additions & 2 deletions go/libraries/doltcore/merge/three_way_json_differ.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package merge

import (
"bytes"
"context"
"io"
"strings"

Expand Down Expand Up @@ -46,7 +47,7 @@ type ThreeWayJsonDiff struct {
Base, Left, Right, Merged *types.JSONDocument
}

func (differ *ThreeWayJsonDiffer) Next() (ThreeWayJsonDiff, error) {
func (differ *ThreeWayJsonDiffer) Next(ctx context.Context) (ThreeWayJsonDiff, error) {
for {
err := differ.loadNextDiff()
if err != nil {
Expand Down Expand Up @@ -119,7 +120,7 @@ func (differ *ThreeWayJsonDiffer) Next() (ThreeWayJsonDiff, error) {
// If the key existed at base, we can do a recursive three-way merge to resolve
// changes to the values.
// This shouldn't be necessary: if its an object on all three branches, the original diff is recursive.
mergedValue, conflict, err := mergeJSON(*differ.leftCurrentDiff.From,
mergedValue, conflict, err := mergeJSON(ctx, *differ.leftCurrentDiff.From,
*differ.leftCurrentDiff.To,
*differ.rightCurrentDiff.To)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/store/prolly/tree/json_indexed_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ func (i IndexedJsonDocument) tryInsert(ctx context.Context, path string, val sql
}

// Remove is not yet implemented, so we call it on a types.JSONDocument instead.
func (i IndexedJsonDocument) Remove(path string) (types.MutableJSON, bool, error) {
func (i IndexedJsonDocument) Remove(ctx context.Context, path string) (types.MutableJSON, bool, error) {
v, err := i.ToInterface()
if err != nil {
return nil, false, err
}
return types.JSONDocument{Val: v}.Remove(path)
return types.JSONDocument{Val: v}.Remove(ctx, path)
}

// Set is not yet implemented, so we call it on a types.JSONDocument instead.
Expand Down

0 comments on commit 861b779

Please sign in to comment.