Skip to content

Commit f9ebdcb

Browse files
committed
Fixed several bugs with like generation
1 parent 2b317c3 commit f9ebdcb

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/main/java/ldbc/snb/datagen/generator/PersonActivityGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ private void generateWall( Person person, ArrayList<Person> block ) {
7474
for( Post p : wallPosts ) {
7575
export(p);
7676
// generate likes to post
77-
ArrayList<Like> postLikes = likeGenerator_.generateLikes(randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE), wall, p, Like.LikeType.POST);
7877
if( randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE).nextDouble() <= 0.1 ) {
78+
ArrayList<Like> postLikes = likeGenerator_.generateLikes(randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE), wall, p, Like.LikeType.POST);
7979
for( Like l : postLikes ) {
8080
export(l);
8181
}
@@ -134,7 +134,7 @@ private void generateGroups( Person person, ArrayList<Person> block ) {
134134
export(c);
135135
// generate likes to comments
136136
if( c.content().length() > 10 && randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE).nextDouble() <= 0.1 ) {
137-
ArrayList<Like> commentLikes = likeGenerator_.generateLikes(randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE), group, p, Like.LikeType.POST);
137+
ArrayList<Like> commentLikes = likeGenerator_.generateLikes(randomFarm_.get(RandomGeneratorFarm.Aspect.NUM_LIKE), group, c, Like.LikeType.COMMENT);
138138

139139
for( Like l : commentLikes ) {
140140
export(l);

tools/validatePairUniqueness.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
import sys, os
3+
4+
5+
if( len(sys.argv) < 4):
6+
print("Validates that a pair of columns never appear repeated.")
7+
print("Usage: validateIdUniqueness <coulmn1> <column2> <file0> <file1> ... <filen>")
8+
9+
column1=int(sys.argv[1])
10+
column2=int(sys.argv[2])
11+
12+
ids = {}
13+
14+
for i in range(3,len(sys.argv)):
15+
print("Reading "+sys.argv[i])
16+
inputFile = open(sys.argv[i],'r')
17+
index = 0
18+
for line in inputFile.readlines():
19+
if index > 0:
20+
firstId = int((line.split('|'))[column1])
21+
secondId = int((line.split('|'))[column2])
22+
if firstId not in ids:
23+
ids[firstId] = set([])
24+
s = ids[firstId]
25+
if secondId in s:
26+
print("ERROR, Id pair not unique")
27+
print(str(firstId)+" "+str(secondId))
28+
exit(1)
29+
s.add(secondId)
30+
index+=1
31+
inputFile.close()
32+
print("GREAT! All ids are different.")

0 commit comments

Comments
 (0)