Fixed dropped error for some engine errors

This commit is contained in:
Zach Musgrave
2022-09-13 14:49:49 -07:00
parent 4358f26abc
commit 3844a0122d
3 changed files with 11 additions and 4 deletions

View File

@@ -557,8 +557,13 @@ func move(ctx context.Context, rd table.SqlRowReader, wr *mvdata.SqlEngineTableW
err := g.Wait()
if err != nil && err != io.EOF {
// don't lose the rowErr if there is one
if rowErr != nil {
return badCount, fmt.Errorf("%w\n%s", err, rowErr.Error())
}
return badCount, err
}
if rowErr != nil {
return badCount, rowErr
}

View File

@@ -514,13 +514,13 @@ pk,c1,c2,c3,c4,c5
1,1,2,3,4,5
2
DELIM
run dolt table import test -u badline.csv
[ "$status" -eq 1 ]
echo $output
[[ "${lines[0]}" =~ "Additions: 2" ]] || false
[[ "${lines[1]}" =~ "A bad row was encountered" ]] || false
[[ "${lines[2]}" =~ "Bad Row: [2]" ]] || false
[[ "${lines[3]}" =~ "CSV reader expected 6 values, but saw 1" ]] || false
[[ "$output" =~ "row values" ]] || false
[[ "$output" =~ "CSV reader expected 6 values, but saw 1" ]] || false
}
@test "1pk5col-ints: import data from a csv file with a bad header" {

View File

@@ -482,9 +482,11 @@ pk,v1,v2
5,,5
6,,6
DELIM
run dolt table import -u test bad-update.csv
[ "$status" -eq "1" ]
[[ "$output" =~ "Bad Row: [5,<nil>,5]" ]] || false
[[ "$output" =~ "bad row" ]] || false
[[ "$output" =~ "[5,<nil>,5]" ]] || false
[[ "$output" =~ "column name 'v1' is non-nullable but attempted to set a value of null" ]] || false
}