|
|
@@ -1,6 +1,6 @@
|
|
|
package transform
|
|
|
|
|
|
-import org.apache.spark.sql.SparkSession
|
|
|
+import org.apache.spark.sql.{SparkSession, DataFrame}
|
|
|
import org.apache.spark.sql.functions.{when, sum}
|
|
|
|
|
|
case class GamesAnalysis(teams: os.Path, games: os.Path, stats: os.Path) {
|
|
|
@@ -60,11 +60,13 @@ case class GamesAnalysis(teams: os.Path, games: os.Path, stats: os.Path) {
|
|
|
)
|
|
|
.drop($"sgp.game_id", $"sgp.team_id")
|
|
|
|
|
|
- def writeToCsv(output: String) = {
|
|
|
- merged.write.option("header", true).mode("overwrite").csv(output)
|
|
|
- }
|
|
|
-
|
|
|
private def readInput(filePath: os.Path) = {
|
|
|
spark.read.option("multiline", "true").json(filePath.toString())
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+object GamesAnalysis {
|
|
|
+ def writeToCsv(df: DataFrame, output: String) = {
|
|
|
+ df.write.option("header", true).mode("overwrite").csv(output)
|
|
|
+ }
|
|
|
+}
|