Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions platform/ingest/ingest_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func validateNumericRange(columnType string, value interface{}) (isValid bool) {
}
}

func validateNumericType(columnType string, incomingValueType string, value interface{}) (isValid bool) {
func validateNumericType(columnName, columnType string, incomingValueType string, value interface{}) (isValid bool) {
if isFloatingPointType(columnType) && isNumericType(incomingValueType) {
return true
}
Expand All @@ -101,19 +101,19 @@ func validateNumericType(columnType string, incomingValueType string, value inte
if valueAsStr, ok := value.(string); ok {
return util.IsFloat(valueAsStr)
} else {
logger.Error().Msgf("Invalid value type for column of type %s: %T, value: %v", columnType, value, value)
logger.Error().Msgf("Invalid value type for column [%s] of type %s: %T, value: %v", columnName, columnType, value, value)
}
}
if isIntegerType(columnType) && incomingValueType == "String" {
if valueAsStr, ok := value.(string); ok && util.IsInt(valueAsStr) {
valueAsInt, err := util.ToInt64(valueAsStr)
if err != nil {
logger.Error().Msgf("Failed to convert value to int: %v", valueAsStr)
logger.Error().Msgf("Failed to convert value to int: %v when processing data for column [%s]", valueAsStr, columnName)
return false
}
return validateNumericRange(columnType, valueAsInt)
} else {
logger.Error().Msgf("Invalid value type for column of type %s: %T, value: %v", columnType, value, value)
logger.Error().Msgf("Invalid value type for column [%s] of type %s: %T, value: %v", columnName, columnType, value, value)
}
}

Expand All @@ -131,7 +131,7 @@ func validateValueAgainstType(fieldName string, value interface{}, columnType da
columnTypeName := removeLowCardinality(columnType.Name)

if isNumericType(columnTypeName) {
if incomingValueType, isBaseType := incomingValueType.(database_common.BaseType); isBaseType && validateNumericType(columnTypeName, incomingValueType.Name, value) {
if incomingValueType, isBaseType := incomingValueType.(database_common.BaseType); isBaseType && validateNumericType(fieldName, columnTypeName, incomingValueType.Name, value) {
// Numeric types match!
return true
}
Expand Down
Loading