From a7314a163822ad9b73204fb03b24067127659ce1 Mon Sep 17 00:00:00 2001 From: xitongsys Date: Fri, 24 Apr 2020 13:59:13 +0800 Subject: [PATCH] handle non-alpha prefix variable name in parquet --- common/common.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/common.go b/common/common.go index e8190181..a573f80f 100644 --- a/common/common.go +++ b/common/common.go @@ -293,7 +293,13 @@ func HeadToUpper(str string) string { if ln <= 0 { return str } - return strings.ToUpper(str[0:1]) + str[1:] + + c := str[0] + if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') { + return strings.ToUpper(str[0:1]) + str[1:] + } + //handle non-alpha prefix such as "_" + return "P_" + str } //Get the number of bits needed by the num; 0 needs 0, 1 need 1, 2 need 2, 3 need 2 ....