Skip to content

Commit

Permalink
#298 Fix 'pramen-extras' requiring 'delta' format for unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
yruslan committed Nov 22, 2023
1 parent a3a93ae commit 383cf07
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ object RunnerCommons {
log.info(s"Fetching '$file'...")
val fs = new Path(file).getFileSystem(hadoopConfig)


fs.copyToLocalFile(new Path(file), currentPath)
})
}
Expand Down
7 changes: 5 additions & 2 deletions pramen/project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ object Dependencies {
"org.mockito" % "mockito-core" % mockitoVersion % Test,
"de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % embeddedMongoDbVersion % Test,
"org.hsqldb" % "hsqldb" % hsqlDbVersion % Test classifier "jdk8"
) :+ getDeltaDependency(sparkVersion(scalaVersion), isDeltaCompile)
) :+ getDeltaDependency(sparkVersion(scalaVersion), isDeltaCompile, isTest = false)

def ExtrasJobsDependencies(scalaVersion: String): Seq[ModuleID] = Seq(
"org.apache.spark" %% "spark-sql" % sparkVersion(scalaVersion) % Provided,
"net.sourceforge.jtds" % "jtds" % msSqlDriverVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
) :+ getAbrisDependency(scalaVersion)
) ++ Seq(
getAbrisDependency(scalaVersion),
getDeltaDependency(sparkVersion(scalaVersion), isCompile = false, isTest = true)
)

}
16 changes: 10 additions & 6 deletions pramen/project/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object Versions {
}
}

def getDeltaDependency(sparkVersion: String, isCompile: Boolean): ModuleID = {
def getDeltaDependency(sparkVersion: String, isCompile: Boolean, isTest: Boolean): ModuleID = {
// According to this: https://docs.delta.io/latest/releases.html
val (deltaArtifact, deltaVersion) = sparkVersion match {
case version if version.startsWith("2.") => ("delta-core", "0.6.1")
Expand All @@ -79,12 +79,16 @@ object Versions {
case version if version.startsWith("3.5.") => ("delta-spark", "3.0.0") // 'delta-core' was renamed to 'delta-spark' since 3.0.0.
case _ => throw new IllegalArgumentException(s"Spark $sparkVersion not supported.")
}
if (isCompile) {
println(s"Using Delta version $deltaArtifact:$deltaVersion (compile)")
"io.delta" %% deltaArtifact % deltaVersion % Compile
if (isTest) {
"io.delta" %% deltaArtifact % deltaVersion % Test
} else {
println(s"Using Delta version $deltaArtifact:$deltaVersion (provided)")
"io.delta" %% deltaArtifact % deltaVersion % Provided
if (isCompile) {
println(s"Using Delta version $deltaArtifact:$deltaVersion (compile)")
"io.delta" %% deltaArtifact % deltaVersion % Compile
} else {
println(s"Using Delta version $deltaArtifact:$deltaVersion (provided)")
"io.delta" %% deltaArtifact % deltaVersion % Provided
}
}
}

Expand Down

0 comments on commit 383cf07

Please sign in to comment.