From df5767198c3fc5d6cc78e173fbd355b3a8180ef5 Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Mon, 31 Mar 2025 22:26:37 +0530 Subject: [PATCH] fix: don't panic in GetClickhouseColumnName (#7493) --- pkg/query-service/utils/format.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/query-service/utils/format.go b/pkg/query-service/utils/format.go index 743109e86b..1acf9d6ff8 100644 --- a/pkg/query-service/utils/format.go +++ b/pkg/query-service/utils/format.go @@ -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] }