Skip to content

Commit f260355

Browse files
committed
temp
1 parent a6aafa0 commit f260355

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

src/main/java/ldbc/socialnet/dbgen/generator/MRWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public void writeReducedUserProfiles(int from, int to, int pass,
6565
try {
6666
to = to % windowSize;
6767
for (int i = from; i != to; i = (i+1)%windowSize) {
68-
int key = userProfiles[i].getDicElementId(pass);
68+
//int key = userProfiles[i].getDicElementId(pass);
69+
int key[] = userProfiles[i].getDicElementIds();
6970
int block = 0;
7071
long id = userProfiles[i].getAccountId();
7172
MapReduceKey mpk = new MapReduceKey(block,key,id);

src/main/java/ldbc/socialnet/dbgen/generator/ScalableGenerator.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -901,11 +901,7 @@ public void mrGenerateUserInfo(int pass, Context context){
901901
ReducedUserProfile reduceUserProf = generateGeneralInformation(j);
902902
++numUsersToGenerate;
903903
try {
904-
int block = 0; // The mapreduce group this university will be assigned.
905-
int key = reduceUserProf.getDicElementId(pass); // The key used to sort within the block.
906-
long id = reduceUserProf.getAccountId(); // The id used to sort within the key, to guarantee determinism.
907-
MapReduceKey mpk = new MapReduceKey( block, key, id );
908-
context.write(mpk, reduceUserProf);
904+
context.write(generateKey(pass,reduceUserProf), reduceUserProf);
909905
} catch (IOException e) {
910906
e.printStackTrace();
911907
} catch (InterruptedException e) {
@@ -915,6 +911,17 @@ public void mrGenerateUserInfo(int pass, Context context){
915911
}
916912
System.out.println("Number of generated users: "+numUsersToGenerate);
917913
}
914+
private MapReduceKey generateKey( int pass, ReducedUserProfile user ) {
915+
int block = 0; // The mapreduce group this university will be assigned.
916+
int key[] = new int[3];
917+
= reduceUserProf.getDicElementIds(); // The key used to sort within the block.
918+
for( int i = 0; i < NUM_FRIENDSHIP_HADOOP_JOBS;++i) {
919+
key[]
920+
}
921+
long id = reduceUserProf.getAccountId(); // The id used to sort within the key, to guarantee determinism.
922+
MapReduceKey mpk = new MapReduceKey( block, key, id );
923+
return mpk;
924+
}
918925

919926
private void generateCellOfUsers2(int newStartIndex, ReducedUserProfile[] _cellReduceUserProfiles){
920927
int curIdxInWindow;

src/main/java/ldbc/socialnet/dbgen/util/MapReduceKey.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,37 @@
4949

5050
public class MapReduceKey implements WritableComparable<MapReduceKey> {
5151
public int block;
52-
public int key;
52+
public int key[];
5353
public long id;
5454

5555
public MapReduceKey( ) {
56+
this.key = new int[3];
5657
}
5758

58-
public MapReduceKey( int block, int key, long id) {
59+
public MapReduceKey( int block, int key[], long id) {
5960
this.block = block;
60-
this.key = key;
61+
this.key = new int[3];
62+
this.key[0] = key[0];
63+
this.key[1] = key[1];
64+
this.key[2] = key[2];
6165
this.id = id;
6266
}
6367

6468
@Override
6569
public void write(DataOutput out) throws IOException {
6670
out.writeInt(block);
67-
out.writeInt(key);
71+
out.writeInt(key[0]);
72+
out.writeInt(key[1]);
73+
out.writeInt(key[2]);
6874
out.writeLong(id);
6975
}
7076

7177
@Override
7278
public void readFields(DataInput in) throws IOException {
7379
block = in.readInt();
74-
key = in.readInt();
80+
key[0] = in.readInt();
81+
key[1] = in.readInt();
82+
key[2] = in.readInt();
7583
id = in.readLong();
7684
}
7785

src/main/java/ldbc/socialnet/dbgen/util/MapReduceKeyComparator.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2){
5656
int block1 = readInt(b1, s1);
5757
int block2 = readInt(b2, s2);
5858
if( block1 != block2 ) return block1 - block2;
59-
int key1 = readInt(b1,s1+4);
60-
int key2 = readInt(b2,s2+4);
61-
if( key1 != key2) return key1 - key2;
62-
long id1 = readLong(b1,s1+8);
63-
long id2 = readLong(b2,s2+8);
59+
int key1[] = {readInt(b1,s1+4), readInt(b1,s1+8), readInt(b1,s1+12)};
60+
int key2[] = {readInt(b2,s2+4), readInt(b2,s2+8), readInt(b2,s2+12)};
61+
if( key1[0] != key2[0]) return key1[0] - key2[0];
62+
if( key1[1] != key2[1]) return key1[1] - key2[1];
63+
if( key1[2] != key2[2]) return key1[2] - key2[2];
64+
long id1 = readLong(b1,s1+16);
65+
long id2 = readLong(b2,s2+16);
6466
return (int)(id1 - id2);
6567
}
6668
}

0 commit comments

Comments
 (0)