Skip to content

Commit

Permalink
fix decode val
Browse files Browse the repository at this point in the history
  • Loading branch information
wk989898 committed Jan 27, 2025
1 parent 000f895 commit 615728e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/sink/codec/csv/csv_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ func fromColValToCsvVal(csvConfig *common.Config, row *chunk.Row, idx int, colIn
}
}
return row.GetString(idx), nil
case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeNewDate, mysql.TypeTimestamp:
return row.GetTime(idx).String(), nil
case mysql.TypeDuration:
return row.GetDuration(idx, colInfo.GetDecimal()).String(), nil
case mysql.TypeEnum:
enumValue := row.GetEnum(idx).Value
enumVar, err := types.ParseEnumValue(colInfo.GetElems(), enumValue)
Expand All @@ -316,6 +320,10 @@ func fromColValToCsvVal(csvConfig *common.Config, row *chunk.Row, idx int, colIn
d := row.GetDatum(idx, &colInfo.FieldType)
// Encode bits as integers to avoid pingcap/tidb#10988 (which also affects MySQL itself)
return d.GetBinaryLiteral().ToInt(types.DefaultStmtNoWarningContext)
case mysql.TypeNewDecimal:
return row.GetMyDecimal(idx).String(), nil
case mysql.TypeJSON:
return row.GetJSON(idx).String(), nil
case mysql.TypeTiDBVectorFloat32:
vec := row.GetVectorFloat32(idx)
return vec.String(), nil
Expand Down

0 comments on commit 615728e

Please sign in to comment.