@@ -88,7 +88,7 @@ func validateNumericRange(columnType string, value interface{}) (isValid bool) {
8888 }
8989}
9090
91- func validateNumericType (columnType string , incomingValueType string , value interface {}) (isValid bool ) {
91+ func validateNumericType (columnName , columnType string , incomingValueType string , value interface {}) (isValid bool ) {
9292 if isFloatingPointType (columnType ) && isNumericType (incomingValueType ) {
9393 return true
9494 }
@@ -101,19 +101,19 @@ func validateNumericType(columnType string, incomingValueType string, value inte
101101 if valueAsStr , ok := value .(string ); ok {
102102 return util .IsFloat (valueAsStr )
103103 } else {
104- logger .Error ().Msgf ("Invalid value type for column of type %s: %T, value: %v" , columnType , value , value )
104+ logger .Error ().Msgf ("Invalid value type for column [%s] of type %s: %T, value: %v" , columnName , columnType , value , value )
105105 }
106106 }
107107 if isIntegerType (columnType ) && incomingValueType == "String" {
108108 if valueAsStr , ok := value .(string ); ok && util .IsInt (valueAsStr ) {
109109 valueAsInt , err := util .ToInt64 (valueAsStr )
110110 if err != nil {
111- logger .Error ().Msgf ("Failed to convert value to int: %v" , valueAsStr )
111+ logger .Error ().Msgf ("Failed to convert value to int: %v when processing data for column [%s] " , valueAsStr , columnName )
112112 return false
113113 }
114114 return validateNumericRange (columnType , valueAsInt )
115115 } else {
116- logger .Error ().Msgf ("Invalid value type for column of type %s: %T, value: %v" , columnType , value , value )
116+ logger .Error ().Msgf ("Invalid value type for column [%s] of type %s: %T, value: %v" , columnName , columnType , value , value )
117117 }
118118 }
119119
@@ -131,7 +131,7 @@ func validateValueAgainstType(fieldName string, value interface{}, columnType da
131131 columnTypeName := removeLowCardinality (columnType .Name )
132132
133133 if isNumericType (columnTypeName ) {
134- if incomingValueType , isBaseType := incomingValueType .(database_common.BaseType ); isBaseType && validateNumericType (columnTypeName , incomingValueType .Name , value ) {
134+ if incomingValueType , isBaseType := incomingValueType .(database_common.BaseType ); isBaseType && validateNumericType (fieldName , columnTypeName , incomingValueType .Name , value ) {
135135 // Numeric types match!
136136 return true
137137 }
0 commit comments