We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72f35b1 commit b539c7bCopy full SHA for b539c7b
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
@@ -457,10 +457,14 @@ class DataFrameSuite extends QueryTest {
457
Row(key, value, key + 1)
458
}.toSeq)
459
assert(df.schema.map(_.name).toSeq === Seq("key", "value", "newCol"))
460
+ }
461
462
+ test("replace column using withColumn") {
463
val df2 = TestSQLContext.sparkContext.parallelize(Array(1, 2, 3)).toDF("x")
464
val df3 = df2.withColumn("x", df2("x") + 1)
- assert(df3.select("x").collect().toSeq === Seq(Row(2), Row(3), Row(4)))
465
+ checkAnswer(
466
+ df3.select("x"),
467
+ Row(2) :: Row(3) :: Row(4) :: Nil)
468
}
469
470
test("withColumnRenamed") {
0 commit comments