Skip to content

Commit a523302

Browse files
committed
Add examples for null as an argument
1 parent 3283d3a commit a523302

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract class RDG extends UnaryExpression with ExpectsInputTypes with Nondeterm
4646
case Literal(s, IntegerType) => s.asInstanceOf[Int]
4747
case Literal(s, LongType) => s.asInstanceOf[Long]
4848
case _ => throw new AnalysisException(
49-
s"Input argument to $prettyName must be an integer/long/NULL literal.")
49+
s"Input argument to $prettyName must be an integer, long or null literal.")
5050
}
5151

5252
override def nullable: Boolean = false
@@ -66,6 +66,8 @@ abstract class RDG extends UnaryExpression with ExpectsInputTypes with Nondeterm
6666
0.9629742951434543
6767
> SELECT _FUNC_(0);
6868
0.8446490682263027
69+
> SELECT _FUNC_(null);
70+
0.8446490682263027
6971
""")
7072
// scalastyle:on line.size.limit
7173
case class Rand(child: Expression) extends RDG {
@@ -99,6 +101,8 @@ object Rand {
99101
-0.3254147983080288
100102
> SELECT _FUNC_(0);
101103
1.1164209726833079
104+
> SELECT _FUNC_(null);
105+
1.1164209726833079
102106
""")
103107
// scalastyle:on line.size.limit
104108
case class Randn(child: Expression) extends RDG {

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,6 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
16351635
}
16361636
}
16371637

1638-
<<<<<<< 5213bd60f4be0795e23362f555dcdcf1a1d060cd
16391638
private def verifyNullabilityInFilterExec(
16401639
df: DataFrame,
16411640
expr: String,

0 commit comments

Comments
 (0)