diff --git a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala index c557b54732797..72f56f35bf935 100644 --- a/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala +++ b/connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala @@ -2691,6 +2691,14 @@ class PlanGenerationTestSuite fn.parse_url(fn.col("g"), fn.col("g"), fn.col("g")) } + functionTest("try_parse_url") { + fn.try_parse_url(fn.col("g"), fn.col("g")) + } + + functionTest("try_parse_url with key") { + fn.try_parse_url(fn.col("g"), fn.col("g"), fn.col("g")) + } + functionTest("printf") { fn.printf(fn.col("g"), fn.col("a"), fn.col("g")) } diff --git a/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url.explain b/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url.explain new file mode 100644 index 0000000000000..2fbf751ecf193 --- /dev/null +++ b/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url.explain @@ -0,0 +1,2 @@ +Project [parse_url(g#0, g#0, false) AS try_parse_url(g, g)#0] ++- LocalRelation , [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] diff --git a/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url_with_key.explain b/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url_with_key.explain new file mode 100644 index 0000000000000..74c4a4985acf2 --- /dev/null +++ b/sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url_with_key.explain @@ -0,0 +1,2 @@ +Project [parse_url(g#0, g#0, g#0, false) AS try_parse_url(g, g, g)#0] ++- LocalRelation , [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] diff --git a/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.json b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.json new file mode 100644 index 0000000000000..b9603d5af2634 --- /dev/null +++ b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.json @@ -0,0 +1,29 @@ +{ + "common": { + "planId": "1" + }, + "project": { + "input": { + "common": { + "planId": "0" + }, + "localRelation": { + "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" + } + }, + "expressions": [{ + "unresolvedFunction": { + "functionName": "try_parse_url", + "arguments": [{ + "unresolvedAttribute": { + "unparsedIdentifier": "g" + } + }, { + "unresolvedAttribute": { + "unparsedIdentifier": "g" + } + }] + } + }] + } +} \ No newline at end of file diff --git a/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.proto.bin b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.proto.bin new file mode 100644 index 0000000000000..696c4ddde519c Binary files /dev/null and b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.proto.bin differ diff --git a/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.json b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.json new file mode 100644 index 0000000000000..137ed4bd9bc80 --- /dev/null +++ b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.json @@ -0,0 +1,33 @@ +{ + "common": { + "planId": "1" + }, + "project": { + "input": { + "common": { + "planId": "0" + }, + "localRelation": { + "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" + } + }, + "expressions": [{ + "unresolvedFunction": { + "functionName": "try_parse_url", + "arguments": [{ + "unresolvedAttribute": { + "unparsedIdentifier": "g" + } + }, { + "unresolvedAttribute": { + "unparsedIdentifier": "g" + } + }, { + "unresolvedAttribute": { + "unparsedIdentifier": "g" + } + }] + } + }] + } +} \ No newline at end of file diff --git a/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.proto.bin b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.proto.bin new file mode 100644 index 0000000000000..f4a13872e3c8f Binary files /dev/null and b/sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.proto.bin differ