Skip to content

Commit 82aba8c

Browse files
committed
Merge branch 'tim/load-data-null-default' of ssh://github.com/dolthub/go-mysql-server into tim/load-data-null-default
2 parents ca8ac2a + d1d4f8d commit 82aba8c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

sql/rowexec/ddl_iters.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,20 @@ func (l *loadDataIter) parseFields(ctx *sql.Context, line string) ([]sql.Express
206206
exprs[exprIdx] = expression.NewLiteral(nil, types.Null)
207207
}
208208
}
209-
case "NULL":
210-
// For MySQL LOAD DATA semantics, \N (mapped to NULL here) should use the column default
211-
// if one exists; otherwise insert NULL.
212-
destIdx := l.fieldToColMap[fieldIdx]
213-
if destIdx >= 0 {
214-
destCol := l.destSch[destIdx]
215-
if destCol.Default != nil {
216-
exprs[exprIdx] = destCol.Default
217-
} else {
218-
exprs[exprIdx] = expression.NewLiteral(nil, types.Null)
219-
}
220-
} else {
221-
exprs[exprIdx] = expression.NewLiteral(nil, types.Null)
222-
}
209+
case "NULL":
210+
// For MySQL LOAD DATA semantics, \N (mapped to NULL here) should use the column default
211+
// if one exists; otherwise insert NULL.
212+
destIdx := l.fieldToColMap[fieldIdx]
213+
if destIdx >= 0 {
214+
destCol := l.destSch[destIdx]
215+
if destCol.Default != nil {
216+
exprs[exprIdx] = destCol.Default
217+
} else {
218+
exprs[exprIdx] = expression.NewLiteral(nil, types.Null)
219+
}
220+
} else {
221+
exprs[exprIdx] = expression.NewLiteral(nil, types.Null)
222+
}
223223
default:
224224
exprs[exprIdx] = expression.NewLiteral(field, types.LongText)
225225
}

0 commit comments

Comments
 (0)