fix RowDiffere initialization

This commit is contained in:
Andy Arthur
2020-12-17 13:38:44 -08:00
parent 74bb15f412
commit c518c85d8e
2 changed files with 9 additions and 2 deletions

View File

@@ -189,9 +189,9 @@ SQL
run dolt --keyless sql -q "
SELECT to_c0, to_c1, from_c0, from_c1
FROM dolt_diff_keyless
WHERE from_commit = hashof('HEAD')
ORDER BY to_commit_date" -r csv
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 11 ]
[[ "${lines[0]}" = "to_c0,to_c1,from_c0,from_c1" ]] || false
[[ "${lines[1]}" = "8,8,," ]] || false
[[ "${lines[2]}" = ",,1,1" ]] || false
@@ -199,6 +199,10 @@ SQL
[[ "${lines[4]}" = "1,9,," ]] || false
[[ "${lines[5]}" = "1,9,," ]] || false
[[ "${lines[6]}" = ",,0,0" ]] || false
[[ "${lines[7]}" = "1,1,," ]] || false
[[ "${lines[8]}" = "1,1,," ]] || false
[[ "${lines[9]}" = "0,0,," ]] || false
[[ "${lines[10]}" = "2,2,," ]] || false
}
@test "keyless diff column add/drop" {

View File

@@ -41,9 +41,12 @@ type RowDiffer interface {
func NewRowDiffer(ctx context.Context, fromSch, toSch schema.Schema, buf int) RowDiffer {
ad := NewAsyncDiffer(buf)
if schema.IsKeyless(fromSch) && schema.IsKeyless(toSch) {
// assumes no PK changes
if schema.IsKeyless(fromSch) || schema.IsKeyless(toSch) {
return &keylessDiffer{AsyncDiffer: ad}
}
return ad
}