blob: 4d2f0794b6df055511b8ae76be525de596fe3a2f [file] [log] [blame]
package org.apache.s2graph.s2jobs.wal.process
import com.holdenkarau.spark.testing.DataFrameSuiteBase
import org.apache.s2graph.s2jobs.task.TaskConf
import org.apache.s2graph.s2jobs.wal.DimValCountRank
import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
class BuildTopFeaturesProcessTest extends FunSuite with Matchers with BeforeAndAfterAll with DataFrameSuiteBase {
import org.apache.s2graph.s2jobs.wal.TestData._
test("test entire process.") {
import spark.implicits._
val df = spark.createDataset(aggExpected).toDF()
val taskConf = new TaskConf(name = "test", `type` = "test", inputs = Seq("input"),
options = Map("minUserCount" -> "0")
)
val job = new BuildTopFeaturesProcess(taskConf)
val inputMap = Map("input" -> df)
val featureDicts = job.execute(spark, inputMap)
.orderBy("dim", "rank")
.map(DimValCountRank.fromRow)
.collect()
featureDicts shouldBe featureDictExpected
}
}