Skip to content

Commit 7080f64

Browse files
committed
Add trim to trimBoth function name normalization
ClickHouse canonicalizes trim() to trimBoth() in EXPLAIN AST output. This fixes many text/token index tests that use trim().
1 parent f61bbc5 commit 7080f64

20 files changed

Lines changed: 23 additions & 139 deletions

File tree

internal/explain/format.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ func formatBinaryExprForType(expr *ast.BinaryExpr) string {
277277
func NormalizeFunctionName(name string) string {
278278
// ClickHouse normalizes certain function names in EXPLAIN AST
279279
normalized := map[string]string{
280+
"trim": "trimBoth",
280281
"ltrim": "trimLeft",
281282
"rtrim": "trimRight",
282283
"lcase": "lower",

parser/testdata/00765_sql_compatibility_aliases/metadata.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"explain_todo": {
33
"stmt10": true,
4-
"stmt18": true,
54
"stmt2": true,
65
"stmt25": true,
76
"stmt26": true,

parser/testdata/02160_special_functions/metadata.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"explain_todo": {
3-
"stmt11": true,
43
"stmt14": true,
54
"stmt16": true,
65
"stmt18": true,
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt22": true,
4-
"stmt23": true,
5-
"stmt24": true,
6-
"stmt25": true,
7-
"stmt26": true,
8-
"stmt27": true,
9-
"stmt28": true,
10-
"stmt29": true
11-
}
12-
}
1+
{}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt10": true,
4-
"stmt11": true,
5-
"stmt14": true,
6-
"stmt15": true,
7-
"stmt6": true,
8-
"stmt7": true
9-
}
10-
}
1+
{}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt11": true,
4-
"stmt13": true,
5-
"stmt18": true,
6-
"stmt20": true,
7-
"stmt22": true,
8-
"stmt9": true
9-
}
10-
}
1+
{}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt4": true
4-
}
5-
}
1+
{}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"explain_todo": {
3-
"stmt10": true,
4-
"stmt13": true,
5-
"stmt15": true,
6-
"stmt17": true
3+
"stmt13": true
74
}
85
}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"explain_todo": {
3-
"stmt10": true,
4-
"stmt12": true,
5-
"stmt14": true,
6-
"stmt16": true,
73
"stmt8": true
84
}
95
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"explain_todo": {
3-
"stmt11": true,
4-
"stmt13": true,
5-
"stmt15": true,
63
"stmt6": true,
7-
"stmt7": true,
8-
"stmt9": true
4+
"stmt7": true
95
}
106
}

0 commit comments

Comments
 (0)