mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-19 02:06:25 -05:00
Fix merge issues and more tests
This commit is contained in:
@@ -17,7 +17,7 @@ package commands
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"io"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -444,13 +444,12 @@ func newSqlEngine(ctx context.Context, dEnv *env.DoltEnv) (*engine.SqlEngine, er
|
||||
ctx,
|
||||
mrEnv,
|
||||
engine.FormatCsv,
|
||||
dbName,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"root",
|
||||
"",
|
||||
false,
|
||||
&engine.SqlEngineConfig{
|
||||
InitialDb: dbName,
|
||||
IsReadOnly: false,
|
||||
ServerUser: "root",
|
||||
Autocommit: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -526,18 +526,25 @@ func GetDiffTableSchemaAndJoiner(format *types.NomsBinFormat, fromSch, toSch sch
|
||||
return nil, nil, err
|
||||
}
|
||||
} else {
|
||||
colCollection := toSch.GetAllCols()
|
||||
colCollection = colCollection.Append(
|
||||
schema.NewColumn("commit", schema.DiffCommitTag, types.StringKind, false),
|
||||
schema.NewColumn("commit_date", schema.DiffCommitDateTag, types.TimestampKind, false))
|
||||
toSch = schema.MustSchemaFromCols(colCollection)
|
||||
|
||||
colCollection = fromSch.GetAllCols()
|
||||
colCollection := schema.NewColCollection()
|
||||
if fromSch != nil {
|
||||
colCollection = fromSch.GetAllCols()
|
||||
}
|
||||
colCollection = colCollection.Append(
|
||||
schema.NewColumn("commit", schema.DiffCommitTag, types.StringKind, false),
|
||||
schema.NewColumn("commit_date", schema.DiffCommitDateTag, types.TimestampKind, false))
|
||||
fromSch = schema.MustSchemaFromCols(colCollection)
|
||||
|
||||
colCollection = schema.NewColCollection()
|
||||
if toSch != nil {
|
||||
colCollection = toSch.GetAllCols()
|
||||
}
|
||||
colCollection = colCollection.Append(
|
||||
schema.NewColumn("commit", schema.DiffCommitTag, types.StringKind, false),
|
||||
schema.NewColumn("commit_date", schema.DiffCommitDateTag, types.TimestampKind, false))
|
||||
toSch = schema.MustSchemaFromCols(colCollection)
|
||||
|
||||
j, err = rowconv.NewJoiner(
|
||||
[]rowconv.NamedSchema{{Name: diff.To, Sch: toSch}, {Name: diff.From, Sch: fromSch}},
|
||||
map[string]rowconv.ColNamingFunc{
|
||||
|
||||
@@ -2992,12 +2992,20 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{
|
||||
Name: "new table",
|
||||
SetUpScript: []string{
|
||||
"create table t1 (a int primary key, b int)",
|
||||
"insert into t1 values (1,1)",
|
||||
"insert into t1 values (1,2)",
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "select * from dolt_diff",
|
||||
Expected: nil,
|
||||
Query: "select to_a, to_b, from_commit, to_commit, diff_type from dolt_diff('t1', 'HEAD', 'WORKING')",
|
||||
Expected: []sql.Row{{1, 2, "HEAD", "WORKING", "added"}},
|
||||
},
|
||||
{
|
||||
Query: "select to_a, from_b, from_commit, to_commit, diff_type from dolt_diff('t1', 'HEAD', 'WORKING')",
|
||||
ExpectedErr: sql.ErrColumnNotFound,
|
||||
},
|
||||
{
|
||||
Query: "select from_a, from_b, from_commit, to_commit, diff_type from dolt_diff('t1', 'WORKING', 'HEAD')",
|
||||
Expected: []sql.Row{{1, 2, "WORKING", "HEAD", "removed"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user