Skip to content

Commit

Permalink
reverted the debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
razajafri committed Jul 15, 2024
1 parent 8d0351b commit 8d74758
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class OpcodeSuite extends AnyFunSuite {
val myudf: Boolean => Boolean = { x => !x }
val u = makeUdf(myudf)
val dataset = List(true, false, true, false).toDS().repartition(1)
val result = dataset.withColumn("new", u(Symbol("value")))
val result = dataset.withColumn("new", u('value))
val equiv = dataset.withColumn("new", not(col("value")))
checkEquiv(result, equiv)
}
Expand Down Expand Up @@ -796,24 +796,20 @@ class OpcodeSuite extends AnyFunSuite {

test("IFNONNULL opcode") {
val myudf: (String, String) => String = (a,b) => {
// val (empty, nonempty) = if (a.isEmpty) {
// println("a is empty")
// (a, b)
// }
// else (b, a)
val (empty, nonempty) = if (a.isEmpty) {
println("a is empty")
(a, b)
}
else (b, a)
a match {
case null => a
case _ => b
}
}
val u = makeUdf(myudf)
println(myudf("", "z"))
val dataset = List(("","z")).toDF("x","y")
dataset.show()
val result = dataset.withColumn("new", u(col("x"),col("y")))
result.show()
val ref = dataset.withColumn("new", lit("z"))
ref.show()
checkEquiv(result, ref)
}

Expand Down

0 comments on commit 8d74758

Please sign in to comment.