fix: don't panic in GetClickhouseColumnName (#7493)

This commit is contained in:
Nityananda Gohain 2025-03-31 22:26:37 +05:30 committed by GitHub
parent 81c7f3221a
commit df5767198c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -303,7 +303,7 @@ func GetClickhouseColumnName(typeName string, dataType, field string) string {
typeName = constants.Attributes
}
if typeName != string(v3.AttributeKeyTypeResource) {
if typeName != string(v3.AttributeKeyTypeResource) && len(typeName) > 0 {
typeName = typeName[:len(typeName)-1]
}
@ -319,7 +319,7 @@ func GetClickhouseColumnNameV2(typeName string, dataType, field string) string {
typeName = constants.Attributes
}
if typeName != string(v3.AttributeKeyTypeResource) {
if typeName != string(v3.AttributeKeyTypeResource) && len(typeName) > 0 {
typeName = typeName[:len(typeName)-1]
}