-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from opentargets/1767-multiple-output-formats
1767 multiple output formats
- Loading branch information
Showing
7 changed files
with
90 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/test/scala/io/opentargets/etl/backend/target/IoHelpersTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.opentargets.etl.backend.target | ||
import io.opentargets.etl.backend.EtlSparkUnitTest | ||
import io.opentargets.etl.backend.spark.{IOResource, IOResourceConfig, IoHelpers} | ||
import io.opentargets.etl.backend.spark.IoHelpers.IOResources | ||
import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper | ||
|
||
class IoHelpersTest extends EtlSparkUnitTest { | ||
|
||
"Additional formats" should "be added to IOResources outputs" in { | ||
// given | ||
import sparkSession.implicits._ | ||
val addFormats = PrivateMethod[IOResources]('addAdditionalOutputFormats) | ||
val df = Seq(1).toDF | ||
val resources: IOResources = Map("one" -> IOResource(df, IOResourceConfig("f1", "p1/f1/out"))) | ||
val configs: List[String] = List("f2") | ||
|
||
// when | ||
val result = IoHelpers invokePrivate addFormats(resources, configs, "parquet") | ||
|
||
// then | ||
// an entry created for each format | ||
result should have size (2) | ||
// the dataframe is cached | ||
result.head._2.data.storageLevel.useMemory should be(true) | ||
} | ||
} |