@@ -762,8 +762,9 @@ func (kr *KafkaRunner) kafkaTransformSnapshotData(
762762 value = TimeValue (valueStr )
763763 case mysqlconfig .TimestampColumnType :
764764 if valueStr != "" {
765- value = TimeStamp (valueStr , kr . location )
765+ value = TimeStamp (valueStr )
766766 } else {
767+ // TODO what?
767768 value = TimeValue (valueStr )
768769 }
769770 case mysqlconfig .BinaryColumnType :
@@ -790,13 +791,14 @@ func (kr *KafkaRunner) kafkaTransformSnapshotData(
790791 valueStr = "char(255)"
791792 }
792793 value = base64 .StdEncoding .EncodeToString ([]byte (valueStr ))
793- case mysqlconfig .DateColumnType , mysqlconfig . DateTimeColumnType :
794- if valueStr != "" && columnList [ i ]. ColumnType == "datetime" {
794+ case mysqlconfig .DateTimeColumnType :
795+ if valueStr != "" {
795796 value = DateTimeValue (valueStr , kr .location )
796- } else if valueStr != "" {
797+ }
798+ case mysqlconfig .DateColumnType :
799+ if valueStr != "" {
797800 value = DateValue (valueStr )
798801 }
799-
800802 case mysqlconfig .YearColumnType :
801803 if valueStr != "" {
802804 value = YearValue (valueStr )
@@ -1072,18 +1074,22 @@ func (kr *KafkaRunner) kafkaConvertArg(column *mysqlconfig.Column, theValue inte
10721074 theValue = int64 (theValue .(uint64 ))
10731075 }
10741076 }
1075- case mysqlconfig .TimeColumnType , mysqlconfig .TimestampColumnType :
1076- if theValue != nil && column .ColumnType == "timestamp" {
1077- theValue = TimeStamp (theValue .(string ), kr .location )
1078- } else if theValue != nil {
1077+ case mysqlconfig .TimeColumnType :
1078+ if theValue != nil {
10791079 theValue = TimeValue (theValue .(string ))
10801080 }
1081- case mysqlconfig .DateColumnType , mysqlconfig .DateTimeColumnType :
1082- if theValue != nil && column .ColumnType == "datetime" {
1083- theValue = DateTimeValue (theValue .(string ), kr .location )
1084- } else if theValue != nil {
1081+ case mysqlconfig .TimestampColumnType :
1082+ if theValue != nil {
1083+ theValue = TimeStamp (theValue .(string ))
1084+ }
1085+ case mysqlconfig .DateColumnType :
1086+ if theValue != nil {
10851087 theValue = DateValue (theValue .(string ))
10861088 }
1089+ case mysqlconfig .DateTimeColumnType :
1090+ if theValue != nil {
1091+ theValue = DateTimeValue (theValue .(string ), kr .location )
1092+ }
10871093 case mysqlconfig .VarbinaryColumnType :
10881094 if theValue != nil {
10891095 theValue = encodeStringInterfaceToBase64String (theValue )
@@ -1294,19 +1300,15 @@ func kafkaColumnListToColDefs(colList *common.ColumnList, loc *time.Location) (v
12941300 case mysqlconfig .DecimalColumnType :
12951301 field = NewDecimalField (cols [i ].Precision , cols [i ].Scale , optional , fieldName , defaultValue )
12961302 case mysqlconfig .DateColumnType :
1297- if cols [i ].ColumnType == "datetime" {
1298- field = NewDateTimeField (optional , fieldName , defaultValue , loc )
1299- } else {
1300- field = NewDateField (SCHEMA_TYPE_INT32 , optional , fieldName , defaultValue )
1301- }
1303+ field = NewDateField (SCHEMA_TYPE_INT32 , optional , fieldName , defaultValue )
13021304 case mysqlconfig .YearColumnType :
13031305 field = NewYearField (SCHEMA_TYPE_INT32 , optional , fieldName , defaultValue )
13041306 case mysqlconfig .DateTimeColumnType :
13051307 field = NewDateTimeField (optional , fieldName , defaultValue , loc )
13061308 case mysqlconfig .TimeColumnType :
13071309 field = NewTimeField (optional , fieldName , defaultValue )
13081310 case mysqlconfig .TimestampColumnType :
1309- field = NewTimeStampField (optional , fieldName , defaultValue , loc )
1311+ field = NewTimeStampField (optional , fieldName , defaultValue )
13101312 case mysqlconfig .JSONColumnType :
13111313 field = NewJsonField (optional , fieldName )
13121314 default :
0 commit comments