Skip to content

Commit

Permalink
Fixed publishLocal errors in test (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsorr authored May 24, 2022
1 parent 74917fc commit e1c9a77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 4 additions & 3 deletions core/src/test/scala/doric/control/WhenBuilderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ class WhenBuilderSpec
}

it("puts null otherwiseNull is selected in rest of cases") {
val whenStructure: DoricColumn[Int] = when[Int]
.caseW(colInt("c1") === lit(100), 1)
.otherwiseNull
val df = List((100, Some(1)), (8, None), (2, None))
.toDF("c1", "whenExpected")
.withColumn(
whenResult,
when[Int]
.caseW(colInt("c1") === lit(100), 1)
.otherwiseNull
whenStructure
)

colInt("c1") === 100
Expand Down
16 changes: 10 additions & 6 deletions core/src/test/scala/doric/sem/JoinOpsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ class JoinOpsSpec extends DoricTestElements with Matchers with EitherValues {
describe("join ops") {

it("works with join of same name and type columns") {
val col1 = colLong(id).cast[String]
val badRight = right
.withColumn(id, colLong(id).cast[String])
.withColumn(id, col1)

left.join(right, "left", colLong(id))
left.join(right, "right", colLong(id))
Expand Down Expand Up @@ -98,7 +99,8 @@ class JoinOpsSpec extends DoricTestElements with Matchers with EitherValues {
val resultDF = left.innerJoinKeepLeftKeys(right, colLong(id))

val keyAsString = "keyAsString"
resultDF.withColumn(keyAsString, colLong(id).cast[String])
val col2 = colLong(id).cast[String]
resultDF.withColumn(keyAsString, col2)
resultDF.schema.length shouldBe 3
}

Expand All @@ -107,15 +109,17 @@ class JoinOpsSpec extends DoricTestElements with Matchers with EitherValues {

val nonKeyColRight = "nonKeyColRight"
val nonKeyColLeft = "nonKeyColLeft"
val value1 = colFromDF[String](otherColumn, right)
val value2 = colFromDF[String](otherColumn, left)
resultDF
.withColumn(nonKeyColRight, colFromDF[String](otherColumn, right))
.withColumn(nonKeyColLeft, colFromDF[String](otherColumn, left))
.withColumn(nonKeyColRight, value1)
.withColumn(nonKeyColLeft, value2)
.collectCols(
(colString(
nonKeyColRight
) === colFromDF[String](otherColumn, right)) && (colString(
) === value1) && (colString(
nonKeyColLeft
) === colFromDF[String](otherColumn, left))
) === value2)
)
.forall(identity) shouldBe true
resultDF.schema.length shouldBe 3
Expand Down

0 comments on commit e1c9a77

Please sign in to comment.