uidBuilder.setIGNORE(false); if (!deleteMode) { uidBuilder.setCOUNT(1); uidBuilder.addUID(event.getId().toString()); } else { uidBuilder.setCOUNT(-1); uidBuilder.addUID(event.getId().toString()); Uid.List uidList = uidBuilder.build(); uidBuilder.setIGNORE(false); if (!deleteMode) { uidBuilder.setCOUNT(1); uidBuilder.addUID(event.getId().toString()); } else { uidBuilder.setCOUNT(-1); uidBuilder.addUID(event.getId().toString()); Uid.List uidList = uidBuilder.build(); Value val = new Value(uidList.toByteArray());
builder.setCOUNT(count); builder.setIGNORE(true); builder.clearUID(); builder.setIGNORE(false); builder.addAllUID(uids); builder.clearREMOVEDUID(); builder.addAllREMOVEDUID(uidsToRemove); builder.addAllQUARANTINEUID(quarantinedIds); log.debug("Building aggregate. Count is " + count + ", uids.size() is " + uids.size() + ". builder size is " + builder.getUIDList().size()); return new Value(builder.build().toByteArray());
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc", true), new Value(createNewUidList("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.1").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.2").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.3").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.4").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
return this; if (other.hasIGNORE()) { setIGNORE(other.getIGNORE()); setCOUNT(other.getCOUNT()); bitField0_ = (bitField0_ & ~0x00000004); } else { ensureUIDIsMutable(); uID_.addAll(other.uID_); onChanged(); bitField0_ = (bitField0_ & ~0x00000008); } else { ensureREMOVEDUIDIsMutable(); rEMOVEDUID_.addAll(other.rEMOVEDUID_); onChanged(); bitField0_ = (bitField0_ & ~0x00000010); } else { ensureQUARANTINEUIDIsMutable(); qUARANTINEUID_.addAll(other.qUARANTINEUID_); onChanged(); this.mergeUnknownFields(other.getUnknownFields()); return this;
for (int i = 0; i < GlobalIndexUidAggregator.MAX / 2; i++) { Builder b = createNewUidList(); b.setIGNORE(false); String uuid = UUID.randomUUID().toString(); savedUUIDs.add(uuid); b.setCOUNT(-1); b.addREMOVEDUID(uuid); Uid.List uidList = b.build(); Value val = new Value(uidList.toByteArray()); values.add(val); for (String uuid : savedUUIDs) { Builder b = createNewUidList(); b.setIGNORE(false); if ((i % 2) == 0) b.setCOUNT(1); else b.setCOUNT(1); b.addUID(uuid); Uid.List uidList = b.build(); Value val = new Value(uidList.toByteArray()); values.add(val);
Uid.List.Builder uidList = Uid.List.parseFrom(keyValue.getValue().get()).toBuilder(); boolean changed = false; for (int i = 0; i < uidList.getUIDList().size(); i++) { String uid = uidList.getUID(i); String newUid = null; if (startKey) { uidList.setUID(i, newUid); changed = true; keyValue = new KeyValue(keyValue.getKey(), uidList.build().toByteArray());
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.1").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.2").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.3").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.4").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc", true), new Value(createNewUidList("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.1").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.2").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.3").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.4").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc", true), new Value(createNewUidList("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.1").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.2").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.3").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.4").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc", true), new Value(createNewUidList("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.1").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.2").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.3").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.4").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
@Test public void testSeenIgnore() throws Exception { Logger.getRootLogger().setLevel(Level.ALL); agg.reset(); Builder b = createNewUidList(); b.setIGNORE(true); b.setCOUNT(0); Uid.List uidList = b.build(); Collection<Value> values = Lists.newArrayList(); Value val = new Value(uidList.toByteArray()); values.add(val); b = createNewUidList(); b.setIGNORE(false); b.setCOUNT(1); b.addUID(UUID.randomUUID().toString()); uidList = b.build(); val = new Value(uidList.toByteArray()); values.add(val); Value result = agg.reduce(new Key("key"), values.iterator()); Uid.List resultList = Uid.List.parseFrom(result.get()); assertEquals(true, resultList.getIGNORE()); assertEquals(0, resultList.getUIDCount()); assertEquals(1, resultList.getCOUNT()); }
TreeMultimap<Key,Value> map = TreeMultimap.create(); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createNewUidList("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abc"), new Value(createremove("abc.0").build().toByteArray())); map.put(newKey("20121002_1", "UUID", "abd"), new Value(createNewUidList("abc.3").build().toByteArray()));
@Test public void testEqualsMax() throws Exception { agg.reset(); List<String> savedUUIDs = new ArrayList<>(); Collection<Value> values = Lists.newArrayList(); for (int i = 0; i < GlobalIndexUidAggregator.MAX; i++) { Builder b = createNewUidList(); b.setIGNORE(false); String uuid = UUID.randomUUID().toString(); savedUUIDs.add(uuid); b.setCOUNT(1); b.addUID(uuid); Uid.List uidList = b.build(); Value val = new Value(uidList.toByteArray()); values.add(val); } Value result = agg.reduce(new Key("key"), values.iterator()); Uid.List resultList = Uid.List.parseFrom(result.get()); assertNotNull(resultList); assertEquals(false, resultList.getIGNORE()); assertEquals(resultList.getUIDCount(), (GlobalIndexUidAggregator.MAX)); List<String> resultListUUIDs = resultList.getUIDList(); for (String s : savedUUIDs) assertTrue(resultListUUIDs.contains(s)); }