From e1c9a772649ba8838c3812d4155369801ab13d78 Mon Sep 17 00:00:00 2001 From: Alfonso Roa Date: Tue, 24 May 2022 12:22:23 +0200 Subject: [PATCH] Fixed publishLocal errors in test (#217) --- .../scala/doric/control/WhenBuilderSpec.scala | 7 ++++--- core/src/test/scala/doric/sem/JoinOpsSpec.scala | 16 ++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/src/test/scala/doric/control/WhenBuilderSpec.scala b/core/src/test/scala/doric/control/WhenBuilderSpec.scala index 11f39a264..f33575ffb 100644 --- a/core/src/test/scala/doric/control/WhenBuilderSpec.scala +++ b/core/src/test/scala/doric/control/WhenBuilderSpec.scala @@ -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 diff --git a/core/src/test/scala/doric/sem/JoinOpsSpec.scala b/core/src/test/scala/doric/sem/JoinOpsSpec.scala index 8f1b4a3f7..e7bb2e6d1 100644 --- a/core/src/test/scala/doric/sem/JoinOpsSpec.scala +++ b/core/src/test/scala/doric/sem/JoinOpsSpec.scala @@ -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)) @@ -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 } @@ -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