You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2024/08/23 06:59:27 UTC
Re: [PR] [SPARK-49306][PYTHON][SQL] Create SQL function aliases for 'zeroifnull' and 'nullifzero' [spark]
MaxGekk commented on code in PR #47851:
URL: https://github.com/apache/spark/pull/47851#discussion_r1728463327
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala:
##########
@@ -331,6 +331,15 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSparkSession {
checkAnswer(df.select(nullif(lit(5), lit(5))), Seq(Row(null)))
}
+ test("nullifzero function") {
+ val df = Seq((0)).toDF("a")
+ checkAnswer(df.selectExpr("nullifzero(0)"), Seq(Row(null)))
Review Comment:
You have already tested the SQL function in the previous PR. I do believe this check is not necessary.
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala:
##########
@@ -331,6 +331,15 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSparkSession {
checkAnswer(df.select(nullif(lit(5), lit(5))), Seq(Row(null)))
}
+ test("nullifzero function") {
+ val df = Seq((0)).toDF("a")
+ checkAnswer(df.selectExpr("nullifzero(0)"), Seq(Row(null)))
+ checkAnswer(df.select(nullifzero(lit(0))), Seq(Row(null)))
+
+ checkAnswer(df.selectExpr("nullifzero(a)"), Seq(Row(null)))
Review Comment:
Let's skip this and add more tests for:
1. Different types: maps, arrays, dates and so on
2. Not-nullable column
3. Types support ordering and do not support
4. Non-foldable column
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org