Skip to content

Commit

Permalink
Merge pull request #397 from ldbc/interactive-factorgen
Browse files Browse the repository at this point in the history
Add factor tables for Interactive
  • Loading branch information
szarnyasg authored Jun 25, 2022
2 parents 5692cea + a6e9d15 commit 95be89f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ object FactorGenerationStage extends DatagenStage with Logging {
.join(undirectedKnows(personKnowsPerson).as("knows"), $"Person1.id" === $"knows.Person1Id", "leftouter")
frequency(knows, value = $"knows.Person2Id", by = Seq($"Person1.id", $"Person1.creationDate", $"Person1.deletionDate"))
},
"personNumFriendsOfFriends" -> Factor(PersonKnowsPersonType, PersonType) { case Seq(personKnowsPerson, person1) =>
val foaf = person1
.as("Person1")
.join(undirectedKnows(personKnowsPerson).as("knows1"), $"Person1.id" === $"knows1.Person1Id", "leftouter")
.join(undirectedKnows(personKnowsPerson).as("knows2"), $"knows1.Person2Id" === $"knows2.Person1Id", "leftouter")
frequency(foaf, value = $"knows2.Person2Id", by = Seq($"Person1.id", $"Person1.creationDate", $"Person1.deletionDate"))
},
"languageNumPosts" -> Factor(PostType) { case Seq(post) =>
frequency(post.where($"language".isNotNull), value = $"id", by = Seq($"language"))
},
Expand Down Expand Up @@ -454,6 +461,13 @@ object FactorGenerationStage extends DatagenStage with Logging {
)
.where($"creationDate" < $"deletionDate")
.coalesce(size)
},
"personFirstNames" -> Factor(PersonType) { case Seq(person) =>
frequency(
person,
value = $"id",
by = Seq($"firstName")
)
}
)
}

0 comments on commit 95be89f

Please sign in to comment.