Skip to content

Commit 84d6780

Browse files
committed
modified unit test in SQLQuerySuite to use udf instead of callUDF
1 parent 477709f commit 84d6780

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,12 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll with SQLTestUtils {
137137

138138
test("SPARK-7158 collect and take return different results") {
139139
import java.util.UUID
140-
import org.apache.spark.sql.types._
141140

142141
val df = Seq(Tuple1(1), Tuple1(2), Tuple1(3)).toDF("index")
143142
// we except the id is materialized once
144-
def id: () => String = () => { UUID.randomUUID().toString() }
143+
val idUdf = udf(() => UUID.randomUUID().toString)
145144

146-
val dfWithId = df.withColumn("id", callUDF(id, StringType))
145+
val dfWithId = df.withColumn("id", idUdf())
147146
// Make a new DataFrame (actually the same reference to the old one)
148147
val cached = dfWithId.cache()
149148
// Trigger the cache

0 commit comments

Comments
 (0)