Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 9028b1e

Browse files
committed
Review remarks #1
1 parent 09ea693 commit 9028b1e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

platform/parsers/elastic_query_dsl/pancake_sql_query_generation_test.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,10 @@ import (
1515
"github.com/stretchr/testify/assert"
1616
"strings"
1717
"testing"
18-
"unicode"
1918
)
2019

2120
const TableName = model.SingleTableNamePlaceHolder
2221

23-
func removeAllWhitespace(s string) string {
24-
result := make([]rune, 0, len(s))
25-
for _, r := range s {
26-
if !unicode.IsSpace(r) {
27-
result = append(result, r)
28-
}
29-
}
30-
return string(result)
31-
}
3222
func TestPancakeQueryGeneration(t *testing.T) {
3323

3424
// logger.InitSimpleLoggerForTestsWarnLevel()
@@ -117,8 +107,7 @@ func TestPancakeQueryGeneration(t *testing.T) {
117107
}
118108
prettyExpectedSql := util.SqlPrettyPrint([]byte(strings.TrimSpace(expectedSql)))
119109

120-
//util.AssertSqlEqual(t, prettyExpectedSql, prettyExpectedSql)
121-
assert.Equal(t, removeAllWhitespace(prettyPancakeSql), removeAllWhitespace(prettyExpectedSql))
110+
assert.Equal(t, util.RemoveAllWhitespaces(prettyPancakeSql), util.RemoveAllWhitespaces(prettyExpectedSql))
122111
_, ok := pancakeSql.Type.(PancakeQueryType)
123112
if !ok {
124113
assert.Fail(t, "Expected pancake query type")

platform/util/utils.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strings"
2323
"sync"
2424
"testing"
25+
"unicode"
2526
)
2627

2728
type JsonMap = map[string]interface{}
@@ -1055,3 +1056,13 @@ func PrintfIfErr(err error, msg string, args ...any) {
10551056
fmt.Println(err)
10561057
}
10571058
}
1059+
1060+
func RemoveAllWhitespaces(s string) string {
1061+
result := make([]rune, 0, len(s))
1062+
for _, r := range s {
1063+
if !unicode.IsSpace(r) {
1064+
result = append(result, r)
1065+
}
1066+
}
1067+
return string(result)
1068+
}

0 commit comments

Comments
 (0)