-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add withColumn to a case class (#208)
* fix slightly confusing documentation on smartproject * add withColumn to case class rename existing withColumn to withColumnTupled
- Loading branch information
1 parent
4fd33e1
commit 1bd7e57
Showing
4 changed files
with
154 additions
and
12 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
25 changes: 25 additions & 0 deletions
25
dataset/src/test/scala/frameless/WithColumnTupledTest.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,25 @@ | ||
package frameless | ||
|
||
import org.scalacheck.Prop | ||
import org.scalacheck.Prop._ | ||
|
||
class WithColumnTupledTest extends TypedDatasetSuite { | ||
test("append five columns") { | ||
def prop[A: TypedEncoder](value: A): Prop = { | ||
val d = TypedDataset.create(X1(value) :: Nil) | ||
val d1 = d.withColumnTupled(d('a)) | ||
val d2 = d1.withColumnTupled(d1('_1)) | ||
val d3 = d2.withColumnTupled(d2('_2)) | ||
val d4 = d3.withColumnTupled(d3('_3)) | ||
val d5 = d4.withColumnTupled(d4('_4)) | ||
|
||
(value, value, value, value, value, value) ?= d5.collect().run().head | ||
} | ||
|
||
check(prop[Int] _) | ||
check(prop[Long] _) | ||
check(prop[String] _) | ||
check(prop[SQLDate] _) | ||
check(prop[Option[X1[Boolean]]] _) | ||
} | ||
} |