Skip to content

Commit

Permalink
Reorganize content
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Herrera committed Jul 30, 2024
1 parent 63d6081 commit 3965beb
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 64 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.app

import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.config.AppContext
import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.job.AvgSpendingJob
import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.service.{Reader, Writer}

object AvgSpendingApp extends SparkApp {

private val appName = "avg-spending-app"

private val context = AppContext.load(args)

spark.conf.set("spark.app.name", appName)

private val reader = Reader()

private val writer = Writer()

private val job = AvgSpendingJob(context, reader, writer)

job.run()
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ case class SourceConfig(format: String, options: Map[String, String])
case class SinkConfig(format: String, mode: String, path: String)

object AppConfig {
def load(args: Array[String], appName: String): AppConfig = {
def load(args: Array[String]): AppConfig = {

val cmdArgs = ArgumentsParser.parse(args).getOrElse(CmdArgs())
val configFile = new File(cmdArgs.configFile.get)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.job

import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.config.AppConfig
import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.config.AppContext
import org.apache.spark.sql.SparkSession
import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.extensions.DataFrameExtensions._
import com.codely.lesson_02_tests_in_spark.video_01__end_to_end_testing.service.{Reader, Writer}

case class AvgSpendingJob(
config: AppConfig,
config: AppContext,
reader: Reader,
writer: Writer
)(implicit spark: SparkSession) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.codely.lesson_02_tests_in_spark.video_02__unit_testing.service

import org.apache.spark.sql.{DataFrame, SparkSession}

case class Reader()(implicit spark: SparkSession) {
case class StreamReader()(implicit spark: SparkSession) {
def read(format: String, options: Map[String, String]): DataFrame = {
spark.read
spark.readStream
.format(format)
.options(options)
.load()
Expand Down

0 comments on commit 3965beb

Please sign in to comment.