Skip to content

Commit

Permalink
treat date '0000-00-00' as null
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Sep 27, 2024
1 parent a493e59 commit 5e797a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/dbio/iop/stream_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,13 +775,13 @@ func (sp *StreamProcessor) CastVal(i int, val interface{}, col *Column) interfac
cs.BoolCnt++
case col.Type.IsDatetime() || col.Type.IsDate():
dVal, err := sp.CastToTime(val)
if err != nil && val != "0000-00-00 00:00:00" {
if err != nil && !g.In(val, "0000-00-00", "0000-00-00 00:00:00") {
sp.ds.ChangeColumn(i, StringType)
cs.StringCnt++
sVal = cast.ToString(val)
sp.rowChecksum[i] = uint64(len(sVal))
nVal = sVal
} else if dVal.IsZero() || val == "0000-00-00 00:00:00" {
} else if dVal.IsZero() || g.In(val, "0000-00-00", "0000-00-00 00:00:00") {
nVal = nil
cs.NullCnt++
sp.rowBlankValCnt++
Expand Down

0 comments on commit 5e797a2

Please sign in to comment.