@@ -478,8 +478,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
478
478
.as(" Person1" )
479
479
.join(undirectedKnows(personKnowsPerson).as(" knows" ), $" Person1.id" === $" knows.Person1Id" , " leftouter" )
480
480
481
- val personNumFriends = frequency(knows1, value = $" knows.Person2Id" , by = Seq ($" Person1.id" ), agg = count)
482
- .select($" Person1.id" .as(" Person1Id" ), $" frequency" .as(" numFriends" ))
481
+ val personNumFriends = frequency(
482
+ knows1,
483
+ value = $" knows.Person2Id" ,
484
+ by = Seq ($" Person1.id" , $" Person1.creationDate" , $" Person1.deletionDate" ),
485
+ agg = count)
486
+ .select($" Person1.id" .as(" Person1Id" ), $" creationDate" , $" deletionDate" , $" frequency" .as(" numFriends" ))
483
487
484
488
// friends of friends
485
489
val personFriendsOfFriends = personNumFriends.as(" personNumFriends1" )
@@ -489,9 +493,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
489
493
val personNumFriendsOfFriends = frequency(
490
494
personFriendsOfFriends,
491
495
value = $" personNumFriends2.numFriends" ,
492
- by = Seq ($" personNumFriends1.Person1Id" , $" personNumFriends1.numFriends" ),
496
+ by = Seq ($" personNumFriends1.Person1Id" , $" personNumFriends1.creationDate " , $ " personNumFriends1.deletionDate " , $ " personNumFriends1. numFriends" ),
493
497
agg = sum
494
- ).select($" Person1Id" , $" numFriends" , $" frequency" .as(" numFriendsOfFriends" ))
498
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numFriends" , $" frequency" .as(" numFriendsOfFriends" ))
495
499
496
500
personNumFriendsOfFriends
497
501
},
@@ -502,8 +506,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
502
506
.join(post.as(" Post" ), $" Post.CreatorPersonId" === $" Person.id" , " leftouter" )
503
507
504
508
// direct posts
505
- val numPersonPosts = frequency(personPosts, value = $" Post.id" , by = Seq ($" Person.id" ), agg = count)
506
- .select($" Person.id" .as(" Person1Id" ), $" frequency" .as(" numDirectPosts" ))
509
+ val numPersonPosts = frequency(
510
+ personPosts,
511
+ value = $" Post.id" ,
512
+ by = Seq ($" Person.id" , $" Person.creationDate" , $" Person.deletionDate" ),
513
+ agg = count
514
+ ).select($" Person.id" .as(" Person1Id" ), $" creationDate" , $" deletionDate" , $" frequency" .as(" numDirectPosts" ))
507
515
508
516
// posts of friends
509
517
val friendPosts = numPersonPosts.as(" numPersonPosts1" )
@@ -513,9 +521,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
513
521
val numFriendPosts = frequency(
514
522
friendPosts,
515
523
value = $" numPersonPosts2.numDirectPosts" ,
516
- by = Seq ($" numPersonPosts1.Person1Id" , $" numPersonPosts1.numDirectPosts" ),
524
+ by = Seq ($" numPersonPosts1.Person1Id" , $" numPersonPosts1.creationDate " , $ " numPersonPosts1.deletionDate " , $ " numPersonPosts1. numDirectPosts" ),
517
525
agg = sum
518
- ).select($" numPersonPosts1.Person1Id" .as(" Person1Id" ), $" numDirectPosts" , $" frequency" .as(" numFriendPosts" ))
526
+ ).select($" numPersonPosts1.Person1Id" .as(" Person1Id" ), $" creationDate " , $ " deletionDate " , $ " numDirectPosts" , $" frequency" .as(" numFriendPosts" ))
519
527
520
528
// posts of friends of friends
521
529
val friendOfFriendPosts = numFriendPosts.as(" numFriendPosts1" )
@@ -525,9 +533,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
525
533
val numFriendOfFriendPosts = frequency(
526
534
friendOfFriendPosts,
527
535
value = $" numFriendPosts2.numFriendPosts" ,
528
- by = Seq ($" numFriendPosts1.Person1Id" , $" numFriendPosts1.numDirectPosts" , $" numFriendPosts1.numFriendPosts" ),
536
+ by = Seq ($" numFriendPosts1.Person1Id" , $" numFriendPosts1.creationDate " , $ " numFriendPosts1.deletionDate " , $ " numFriendPosts1. numDirectPosts" , $" numFriendPosts1.numFriendPosts" ),
529
537
agg = sum
530
- ).select($" Person1Id" , $" numDirectPosts" , $" numFriendPosts" , $" frequency" .as(" numFriendOfFriendPosts" ))
538
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numDirectPosts" , $" numFriendPosts" , $" frequency" .as(" numFriendOfFriendPosts" ))
531
539
532
540
numFriendOfFriendPosts
533
541
},
@@ -538,8 +546,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
538
546
.as(" Person" )
539
547
.join(comment.as(" Comment" ), $" Comment.CreatorPersonId" === $" Person.id" , " leftouter" )
540
548
541
- val numPersonComments = frequency(personComments, value = $" Comment.id" , by = Seq ($" Person.id" ), agg = count)
542
- .select($" Person.id" .as(" Person1Id" ), $" frequency" .as(" numDirectComments" ))
549
+ val numPersonComments = frequency(
550
+ personComments,
551
+ value = $" Comment.id" ,
552
+ by = Seq ($" Person.id" , $" Person.creationDate" , $" Person.deletionDate" ),
553
+ agg = count
554
+ ).select($" Person.id" .as(" Person1Id" ), $" Person.creationDate" , $" Person.deletionDate" , $" frequency" .as(" numDirectComments" ))
543
555
544
556
// friend comments
545
557
val friendComments = numPersonComments.as(" numPersonComments1" )
@@ -549,16 +561,16 @@ object FactorGenerationStage extends DatagenStage with Logging {
549
561
val numFriendComments = frequency(
550
562
friendComments,
551
563
value = $" numPersonComments2.numDirectComments" ,
552
- by = Seq ($" numPersonComments1.Person1Id" , $" numPersonComments1.numDirectComments" ),
564
+ by = Seq ($" numPersonComments1.Person1Id" , $" numPersonComments1.creationDate " , $ " numPersonComments1.deletionDate " , $ " numPersonComments1. numDirectComments" ),
553
565
agg = sum
554
- ).select($" Person1Id" , $" numDirectComments" , $" frequency" .as(" numFriendComments" ))
566
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numDirectComments" , $" frequency" .as(" numFriendComments" ))
555
567
numFriendComments
556
568
},
557
569
// likes
558
570
" personLikesNumMessages" -> Factor (PersonType , PersonLikesCommentType , PersonLikesPostType ) { case Seq (person, personLikesComment, personLikesPost) =>
559
571
val personLikesMessage =
560
572
personLikesComment.select($" PersonId" , $" CommentId" .as(" MessageId" )) |+|
561
- personLikesPost.select($" PersonId" , $" PostId" .as(" MessageId" ))
573
+ personLikesPost.select($" PersonId" , $" PostId" .as(" MessageId" ))
562
574
563
575
val messages = person
564
576
.as(" Person" )
@@ -567,9 +579,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
567
579
val personLikesNumMessages = frequency(
568
580
messages,
569
581
value = $" personLikesMessage.MessageId" ,
570
- by = Seq ($" Person.id" ),
582
+ by = Seq ($" Person.id" , $ " Person.creationDate " , $ " Person.deletionDate " ),
571
583
agg = count
572
- )
584
+ ).select($ " id " .as( " Person1Id " ), $ " creationDate " , $ " deletionDate " , $ " frequency " )
573
585
personLikesNumMessages
574
586
},
575
587
// tags
@@ -579,8 +591,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
579
591
.as(" Person" )
580
592
.join(interest.as(" interest" ), $" interest.PersonId" === $" Person.id" , " leftouter" )
581
593
582
- val numPersonTags = frequency(personComments, value = $" TagId" , by = Seq ($" PersonId" ), agg = count)
583
- .select($" PersonId" .as(" Person1Id" ), $" frequency" .as(" numDirectTags" ))
594
+ val numPersonTags = frequency(
595
+ personComments,
596
+ value = $" TagId" ,
597
+ by = Seq ($" PersonId" , $" Person.creationDate" , $" Person.deletionDate" ),
598
+ agg = count
599
+ ).select($" PersonId" .as(" Person1Id" ), $" Person.creationDate" , $" Person.deletionDate" , $" frequency" .as(" numDirectTags" ))
584
600
585
601
// tags of friends
586
602
val friendTags = numPersonTags.as(" numPersonTags1" )
@@ -590,9 +606,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
590
606
val numFriendTags = frequency(
591
607
friendTags,
592
608
value = $" numPersonTags2.numDirectTags" ,
593
- by = Seq ($" numPersonTags1.Person1Id" , $" numPersonTags1.numDirectTags" ),
609
+ by = Seq ($" numPersonTags1.Person1Id" , $" numPersonTags1.creationDate " , $ " numPersonTags1.deletionDate " , $ " numPersonTags1. numDirectTags" ),
594
610
agg = sum
595
- ).select($" Person1Id" , $" numDirectTags" , $" frequency" .as(" numFriendTags" ))
611
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numDirectTags" , $" frequency" .as(" numFriendTags" ))
596
612
numFriendTags
597
613
},
598
614
// forums
@@ -639,8 +655,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
639
655
val directCompanies = person.as(" Person" )
640
656
.join(workAt.as(" workAt" ), $" workAt.PersonId" === $" Person.id" , " leftouter" )
641
657
642
- val numCompanies = frequency(directCompanies, value = $" CompanyId" , by = Seq ($" Person.id" ), agg = count)
643
- .select($" Person.id" .as(" Person1Id" ), $" frequency" .as(" numDirectCompanies" ))
658
+ val numCompanies = frequency(
659
+ directCompanies,
660
+ value = $" CompanyId" ,
661
+ by = Seq ($" Person.id" , $" Person.creationDate" , $" Person.deletionDate" ),
662
+ agg = count
663
+ ).select($" Person.id" .as(" Person1Id" ), $" Person.creationDate" , $" Person.deletionDate" , $" frequency" .as(" numDirectCompanies" ))
644
664
645
665
val friendCompanies = numCompanies.as(" numCompanies1" )
646
666
.join(undirectedKnows(personKnowsPerson).as(" knows" ), $" numCompanies1.Person1Id" === $" knows.Person1Id" , " leftouter" )
@@ -650,9 +670,9 @@ object FactorGenerationStage extends DatagenStage with Logging {
650
670
val numFriendCompanies = frequency(
651
671
friendCompanies,
652
672
value = $" numCompanies2.numDirectCompanies" ,
653
- by = Seq ($" numCompanies1.Person1Id" , $" numCompanies1.numDirectCompanies" ),
673
+ by = Seq ($" numCompanies1.Person1Id" , $" numCompanies1.creationDate " , $ " numCompanies1.deletionDate " , $ " numCompanies1. numDirectCompanies" ),
654
674
agg = sum
655
- ).select($" Person1Id" , $" numDirectCompanies" , $" frequency" .as(" numFriendCompanies" ))
675
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numDirectCompanies" , $" frequency" .as(" numFriendCompanies" ))
656
676
657
677
// companies of friends of friends
658
678
val friendOfFriendCompanies = numFriendCompanies.as(" numFriendCompanies1" )
@@ -662,9 +682,12 @@ object FactorGenerationStage extends DatagenStage with Logging {
662
682
val numFriendOfFriendCompanies = frequency(
663
683
friendOfFriendCompanies,
664
684
value = $" numFriendCompanies2.numFriendCompanies" ,
665
- by = Seq ($" numFriendCompanies1.Person1Id" , $" numFriendCompanies1.numDirectCompanies" , $" numFriendCompanies1.numFriendCompanies" ),
685
+ by = Seq (
686
+ $" numFriendCompanies1.Person1Id" , $" numFriendCompanies1.creationDate" , $" numFriendCompanies1.deletionDate" ,
687
+ $" numFriendCompanies1.numDirectCompanies" , $" numFriendCompanies1.numFriendCompanies"
688
+ ),
666
689
agg = sum
667
- ).select($" Person1Id" , $" numDirectCompanies" , $" numFriendCompanies" , $" frequency" .as(" numFriendOfFriendCompanies" ))
690
+ ).select($" Person1Id" , $" creationDate " , $ " deletionDate " , $ " numDirectCompanies" , $" numFriendCompanies" , $" frequency" .as(" numFriendOfFriendCompanies" ))
668
691
669
692
numFriendOfFriendCompanies
670
693
},
0 commit comments