Skip to content

Commit c558d4d

Browse files
jovanm-dbMaxGekk
authored andcommitted
[SPARK-50031][SQL][FOLLOW-UP] Add tests for try_parse_url in the connect module
### What changes were proposed in this pull request? Add tests in `PlanGenerationTestSuite` for `try_parse_url` function introduced in [this](#48500) PR and generate the corresponding golden files. ### Why are the changes needed? The added tests ensure the new function behaves as expected. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Tests added. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #48637 from jovanm-db/goldenFiles. Authored-by: Jovan Markovic <[email protected]> Signed-off-by: Max Gekk <[email protected]>
1 parent 6e82d59 commit c558d4d

File tree

7 files changed

+74
-0
lines changed

7 files changed

+74
-0
lines changed

connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,14 @@ class PlanGenerationTestSuite
26912691
fn.parse_url(fn.col("g"), fn.col("g"), fn.col("g"))
26922692
}
26932693

2694+
functionTest("try_parse_url") {
2695+
fn.try_parse_url(fn.col("g"), fn.col("g"))
2696+
}
2697+
2698+
functionTest("try_parse_url with key") {
2699+
fn.try_parse_url(fn.col("g"), fn.col("g"), fn.col("g"))
2700+
}
2701+
26942702
functionTest("printf") {
26952703
fn.printf(fn.col("g"), fn.col("a"), fn.col("g"))
26962704
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Project [parse_url(g#0, g#0, false) AS try_parse_url(g, g)#0]
2+
+- LocalRelation <empty>, [id#0L, a#0, b#0, d#0, e#0, f#0, g#0]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Project [parse_url(g#0, g#0, g#0, false) AS try_parse_url(g, g, g)#0]
2+
+- LocalRelation <empty>, [id#0L, a#0, b#0, d#0, e#0, f#0, g#0]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"common": {
3+
"planId": "1"
4+
},
5+
"project": {
6+
"input": {
7+
"common": {
8+
"planId": "0"
9+
},
10+
"localRelation": {
11+
"schema": "struct\u003cid:bigint,a:int,b:double,d:struct\u003cid:bigint,a:int,b:double\u003e,e:array\u003cint\u003e,f:map\u003cstring,struct\u003cid:bigint,a:int,b:double\u003e\u003e,g:string\u003e"
12+
}
13+
},
14+
"expressions": [{
15+
"unresolvedFunction": {
16+
"functionName": "try_parse_url",
17+
"arguments": [{
18+
"unresolvedAttribute": {
19+
"unparsedIdentifier": "g"
20+
}
21+
}, {
22+
"unresolvedAttribute": {
23+
"unparsedIdentifier": "g"
24+
}
25+
}]
26+
}
27+
}]
28+
}
29+
}
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"common": {
3+
"planId": "1"
4+
},
5+
"project": {
6+
"input": {
7+
"common": {
8+
"planId": "0"
9+
},
10+
"localRelation": {
11+
"schema": "struct\u003cid:bigint,a:int,b:double,d:struct\u003cid:bigint,a:int,b:double\u003e,e:array\u003cint\u003e,f:map\u003cstring,struct\u003cid:bigint,a:int,b:double\u003e\u003e,g:string\u003e"
12+
}
13+
},
14+
"expressions": [{
15+
"unresolvedFunction": {
16+
"functionName": "try_parse_url",
17+
"arguments": [{
18+
"unresolvedAttribute": {
19+
"unparsedIdentifier": "g"
20+
}
21+
}, {
22+
"unresolvedAttribute": {
23+
"unparsedIdentifier": "g"
24+
}
25+
}, {
26+
"unresolvedAttribute": {
27+
"unparsedIdentifier": "g"
28+
}
29+
}]
30+
}
31+
}]
32+
}
33+
}
Binary file not shown.

0 commit comments

Comments
 (0)