Skip to content

Commit 438fa9d

Browse files
committed
Add a suite for the Dataset stuff, there isn't much in their yet but
1 parent e472246 commit 438fa9d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Checks basic Dataset magics
3+
*/
4+
package com.highperformancespark.examples.dataframe
5+
6+
import com.highperformancespark.examples.dataframe.HappyPandas.{PandaInfo, Pandas}
7+
import com.holdenkarau.spark.testing._
8+
import org.apache.spark.sql.types._
9+
import org.apache.spark.sql.{DataFrame, Row, SQLContext}
10+
import org.scalatest.Matchers._
11+
import org.scalatest.FunSuite
12+
13+
import scala.collection.mutable
14+
import scala.util.Random
15+
16+
class HappyPandasTest extends FunSuite with DataFrameSuiteBase {
17+
18+
val rawPandaList = List(
19+
RawPanda(10L, "94110", "giant", true, Array(1.0, 0.9)),
20+
RawPanda(11L, "94110", "red", true, Array(1.0, 0.9)))
21+
22+
val mixedDS = MixedDataset(sqlContext)
23+
24+
test("happy panda sums") {
25+
val sqlCtx = sqlContext
26+
import sqlCtx.implicits._
27+
val inputDF = sqlCtx.createDataFrame(rawPandaList)
28+
val inputDS = inputDF.as[RawPanda]
29+
val result = mixedDS.happyPandaSums(inputDS)
30+
assert(result === (2.0 +- 0.001))
31+
}
32+
33+
}

0 commit comments

Comments
 (0)