@@ -526,26 +526,26 @@ object FactorGenerationStage extends DatagenStage with Logging {
526
526
numFriendOfFriendPosts
527
527
},
528
528
// comments
529
- " personNumComments" -> Factor (PersonType , PostType ) { case Seq (person, comment) =>
530
- val comments = person
531
- .as(" Person" )
532
- .join(comment.as(" comment" ), $" comment.CreatorPersonId" === $" Person.id" , " leftouter" )
533
-
534
- val numComments = frequency(comments, value = $" comment.id" , by = Seq ($" Person.id" ))
535
- numComments
536
- },
537
529
" personNumFriendComments" -> Factor (PersonType , PersonKnowsPersonType , CommentType ) { case Seq (person, personKnowsPerson, comment) =>
530
+ // direct comments
538
531
val personComments = person
539
532
.as(" Person" )
540
533
.join(comment.as(" Comment" ), $" Comment.CreatorPersonId" === $" Person.id" , " leftouter" )
541
534
542
535
val numPersonComments = frequency(personComments, value = $" Comment.id" , by = Seq ($" Person.id" ), agg = count)
543
- .select($" Person.id" .as(" Person1Id" ), $" frequency" )
536
+ .select($" Person.id" .as(" Person1Id" ), $" frequency" .as( " numDirectComments " ) )
544
537
545
- val friendComments = numPersonComments.as(" numPersonComments" )
546
- .join(undirectedKnows(personKnowsPerson).as(" knows" ), $" numPersonComments.Person1Id" === $" knows.Person2Id" , " leftouter" )
538
+ // friend comments
539
+ val friendComments = numPersonComments.as(" numPersonComments1" )
540
+ .join(undirectedKnows(personKnowsPerson).as(" knows" ), $" numPersonComments1.Person1Id" === $" knows.Person1Id" , " leftouter" )
541
+ .join(numPersonComments.as(" numPersonComments2" ), $" numPersonComments2.Person1Id" === $" knows.Person2Id" , " leftouter" )
547
542
548
- val numFriendComments = frequency(friendComments, value = $" frequency" , by = Seq ($" knows.Person1Id" ), agg = sum)
543
+ val numFriendComments = frequency(
544
+ friendComments,
545
+ value = $" numPersonComments2.numDirectComments" ,
546
+ by = Seq ($" numPersonComments1.Person1Id" , $" numPersonComments1.numDirectComments" ),
547
+ agg = sum
548
+ )
549
549
numFriendComments
550
550
},
551
551
// likes
0 commit comments