fix: s3 sql parse error for colums as with quotes (#18765)

This commit is contained in:
jiuker
2024-01-10 01:19:11 +08:00
committed by GitHub
parent 3a90af0bcd
commit a89e0bab7d
3 changed files with 19 additions and 1 deletions

View File

@@ -112,6 +112,14 @@ func ParseSelectStatement(s string) (stmt SelectStatement, err error) {
// Set table alias
stmt.tableAlias = selectAST.From.As
// Remove quotes from column aliases
if selectAST.Expression != nil {
for _, exp := range selectAST.Expression.Expressions {
if strings.HasSuffix(exp.As, "'") && strings.HasPrefix(exp.As, "'") && len(exp.As) >= 2 {
exp.As = exp.As[1 : len(exp.As)-1]
}
}
}
return
}