Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test suite
  • Loading branch information
kiszk committed Nov 3, 2016
commit 90d716f6dafe431ef5cc98592dddbdf0f38defcf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ import org.apache.spark.sql.test.SharedSQLContext
class DataFrameComplexTypeSuite extends QueryTest with SharedSQLContext {
import testImplicits._

test("primitive type on array") {
val rows = sparkContext.parallelize(Seq(1, 2), 1).toDF("v").
selectExpr("Array(v + 2, v + 3)")
checkAnswer(rows, Seq(Row(Array(3, 4)), Row(Array(4, 5))))
}

test("primitive type and null on array") {
val rows = sparkContext.parallelize(Seq(1, 2), 1).toDF("v").
selectExpr("Array(v + 2, null, v + 3)")
checkAnswer(rows, Seq(Row(Array(3, null, 4)), Row(Array(4, null, 5))))
}

test("array with null on array") {
val rows = sparkContext.parallelize(Seq(1, 2), 1).toDF("v").
selectExpr("Array(Array(v, v + 1)," +
"null," +
"Array(v, v - 1))").collect
}

test("UDF on struct") {
val f = udf((a: String) => a)
val df = sparkContext.parallelize(Seq((1, 1))).toDF("a", "b")
Expand Down