From 1807c50acb8b292e11a49bad0ac26fb5490fa815 Mon Sep 17 00:00:00 2001 From: Jovan Markovic Date: Thu, 24 Oct 2024 16:13:08 +0200 Subject: [PATCH] Add golden files --- .../spark/sql/PlanGenerationTestSuite.scala | 8 +++++ .../function_try_parse_url.explain | 2 ++ .../function_try_parse_url_with_key.explain | 2 ++ .../queries/function_try_parse_url.json | 29 +++++++++++++++ .../queries/function_try_parse_url.proto.bin | Bin 0 -> 189 bytes .../function_try_parse_url_with_key.json | 33 ++++++++++++++++++ .../function_try_parse_url_with_key.proto.bin | Bin 0 -> 196 bytes 7 files changed, 74 insertions(+) create mode 100644 sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url.explain create mode 100644 sql/connect/common/src/test/resources/query-tests/explain-results/function_try_parse_url_with_key.explain create mode 100644 sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.json create mode 100644 sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url.proto.bin create mode 100644 sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.json create mode 100644 sql/connect/common/src/test/resources/query-tests/queries/function_try_parse_url_with_key.proto.bin 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 0000000000000000000000000000000000000000..696c4ddde519c115ddeae5d780a96fd196c66150 GIT binary patch literal 189 zcmd;L5@3|t#>h2^k&8)yA*!2EsDrV%q^LBx#3nPvDk(EPGp|G^(F#N+S*7HcCgr5+ zq*xJ9VW*R7l~`1iSZM>)XQz{9m77>#1Jsk5m##xdtDR0d$atVqJ1Kc7SuWm^qRRM! V#G>NV_|l>rAyy$~F2-~y1pu)oJc9rL literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..f4a13872e3c8f113b5c362cf5bdf13b8ec00fc67 GIT binary patch literal 196 zcmd;L5@3|t%g8l}k&8)yA*!2EsDrV%q^LBx#3nPvDk(EPGp|G^(F#N+S*7HcCgr5+ zq*xJ9VW*R7l~`1iSZM>)XQz{9m77>#1Jsk5m##xdtDR0d$atVqJ1I3O6)xVAqRRM! V#G>NV_|l>rAyy$~F2;0J3IJiRJvIOU literal 0 HcmV?d00001