HyukjinKwon commented on a change in pull request #25124:
[SPARK-28282][SQL][PYTHON][TESTS] Convert and port 'inline-table.sql' into UDF
test base
URL: https://github.com/apache/spark/pull/25124#discussion_r305177882
##########
File path:
sql/core/src/test/resources/sql-tests/results/udf/udf-inline-table.sql.out
##########
@@ -0,0 +1,153 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 17
+
+
+-- !query 0
+select udf(col1), udf(col2) from values ("one", 1)
+-- !query 0 schema
+struct<CAST(udf(cast(col1 as string)) AS STRING):string,CAST(udf(cast(col2 as
string)) AS INT):int>
+-- !query 0 output
+one 1
+
+
+-- !query 1
+select udf(col1), udf(udf(col2)) from values ("one", 1) as data
+-- !query 1 schema
+struct<CAST(udf(cast(col1 as string)) AS
STRING):string,CAST(udf(cast(cast(udf(cast(col2 as string)) as int) as string))
AS INT):int>
+-- !query 1 output
+one 1
+
+
+-- !query 2
+select udf(a), b from values ("one", 1) as data(a, b)
+-- !query 2 schema
+struct<CAST(udf(cast(a as string)) AS STRING):string,b:int>
+-- !query 2 output
+one 1
+
+
+-- !query 3
+select udf(a) from values 1, 2, 3 as data(a)
+-- !query 3 schema
+struct<CAST(udf(cast(a as string)) AS INT):int>
+-- !query 3 output
+1
+2
+3
+
+
+-- !query 4
+select udf(a), b from values ("one", 1), ("two", 2), ("three", null) as
data(a, b)
+-- !query 4 schema
+struct<CAST(udf(cast(a as string)) AS STRING):string,b:int>
+-- !query 4 output
+one 1
+three NULL
+two 2
+
+
+-- !query 5
+select a, udf(b) from values ("one", null), ("two", null) as data(a, b)
+-- !query 5 schema
+struct<>
+-- !query 5 output
+org.apache.spark.sql.AnalysisException
+cannot resolve 'CAST(udf(cast(b as string)) AS NULL)' due to data type
mismatch: cannot cast string to null; line 1 pos 10
Review comment:
@imback82, let's comment out this test with a comment saying the current UDF
is not supported for the conversion from string to null for now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]