Last active
November 7, 2017 20:50
-
-
Save fwbrasil/c8b0f39b2ea4cf911309229a2b83bf24 to your computer and use it in GitHub Desktop.
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
case class Person(name: String, age: Int) | |
case class Couple(p1: String, p2: String) | |
def sameAgeCouples( | |
people: Dataset[Person], | |
couples: Dataset[Couple] | |
): Dataset[Couple] = | |
run { | |
for { | |
p1 <- liftQuery(people) | |
p2 <- liftQuery(people) | |
c <- liftQuery(couples) | |
if (c.p1 == p1.name && | |
c.p2 == p2.name && | |
p1.age == p2.age) | |
} yield { | |
c | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment