Skip to content

Commit b9b9693

Browse files
author
wangyang
committed
add test
1 parent 97b07a1 commit b9b9693

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,22 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSQLContext {
448448
rand(Random.nextLong()), randn(Random.nextLong())
449449
).foreach(assertValuesDoNotChangeAfterCoalesceOrUnion(_))
450450
}
451+
452+
private def assertNoExceptions(c: Column): Unit = {
453+
for (wholeStage <- Seq(true, false)) {
454+
withSQLConf((SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key, wholeStage.toString)) {
455+
spark.range(0, 5).toDF("a").agg(sum("a")).withColumn("v", c).collect()
456+
}
457+
}
458+
}
459+
460+
test("[SPARK-19471] AggregationIterator does not initialize the generated result projection" +
461+
" before using it") {
462+
Seq(
463+
monotonically_increasing_id(), spark_partition_id(),
464+
rand(Random.nextLong()), randn(Random.nextLong())
465+
).foreach(assertNoExceptions(_))
466+
}
451467
}
452468

453469
object DataFrameFunctionsSuite {

0 commit comments

Comments
 (0)