congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HollowCombiner
Code IndexAdd Tabnine to your IDE (free)

How to use
HollowCombiner
in
com.netflix.hollow.tools.combine

Best Java code snippets using com.netflix.hollow.tools.combine.HollowCombiner (Showing top 14 results out of 315)

origin: Netflix/hollow

public HollowWriteStateEngine patch() {
  Map<String, BitSet> baseMatches = findMatches(base);
  TransitiveSetTraverser.addTransitiveMatches(base, baseMatches);
  TransitiveSetTraverser.removeReferencedOutsideClosure(base, baseMatches);
  Map<String, BitSet> patchFromMatches = findMatches(patchFrom);
  HollowCombinerCopyDirector combineDirector = new HollowPatcherCombinerCopyDirector(base, baseMatches, patchFrom, patchFromMatches);
  HollowCombiner combiner = new HollowCombiner(combineDirector, base, patchFrom);
  combiner.addIgnoredTypes(ignoredTypes);
  combiner.combine();
  return combiner.getCombinedStateEngine();
}
origin: Netflix/hollow

@Override
public int getMappedOrdinal(String type, int originalOrdinal) {
  int typeMapping[] = typeMappings.get(type);
  
  if(typeMapping == null)
    return originalOrdinal;
  
  if(typeMapping[originalOrdinal] == -1)
    typeMapping[originalOrdinal] = combiner.copyOrdinal(type, originalOrdinal);
  
  return typeMapping[originalOrdinal];
}
origin: Netflix/hollow

/**
 * @param copyDirector a {@link HollowCombinerCopyDirector} which will specify which specific records to copy from the input(s).
 * @param output the {@link HollowWriteStateEngine} to use as the destination.
 * @param inputs the set of {@link HollowReadStateEngine} to combine data from.
 */
public HollowCombiner(HollowCombinerCopyDirector copyDirector, HollowWriteStateEngine output, HollowReadStateEngine... inputs) {
  this.inputs = inputs;
  this.output = output;
  this.typeNamesWithDefinedHashCodes = getAllTypesWithDefinedHashCodes();
  this.ordinalRemappers = new OrdinalRemapper[inputs.length];
  this.copiersPerType = new ThreadLocal<Map<String, HollowCombinerCopier>>();
  this.hashOrderIndependentOrdinalMaps = new HashMap<String, ByteArrayOrdinalMap>();
  this.ignoredTypes = new HashSet<String>();
  this.copyDirector = copyDirector;
  initializePrimaryKeys();
}
origin: Netflix/hollow

@Test
public void testExplicitlyExcludedButOtherwiseReferencedKeys() throws IOException {
  HollowPrimaryKeyIndex cIdx3 = new HollowPrimaryKeyIndex(input3, "TypeC", "key");
  HollowCombinerExcludePrimaryKeysCopyDirector director = new HollowCombinerExcludePrimaryKeysCopyDirector();
  director.excludeKey(cIdx3, 8);
  
  HollowCombiner combiner = new HollowCombiner(director, input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key"));
  
  combiner.combine();
  
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  assertObject(output, 9, 3, 8, 3, 8, 3);
}

origin: Netflix/hollow

@Test
public void combinesEvenIfReferencedTypesAreFiltered() throws IOException {
  HollowWriteStateEngine writeEngine = new HollowWriteStateEngine();
  HollowObjectMapper mapper = new HollowObjectMapper(writeEngine);
  
  mapper.add(new TypeA(1, 1));
  mapper.add(new TypeA(2, 2));
  mapper.add(new TypeA(3, 3));
  
  HollowReadStateEngine readEngine = new HollowReadStateEngine();
  HollowFilterConfig filter = new HollowFilterConfig(true);
  filter.addType("TypeB");
  
  StateEngineRoundTripper.roundTripSnapshot(writeEngine, readEngine, filter);
  
  HollowCombiner combiner = new HollowCombiner(readEngine);
  combiner.combine();
  
  HollowWriteStateEngine combined = combiner.getCombinedStateEngine();
  
  HollowReadStateEngine combinedReadStateEngine = StateEngineRoundTripper.roundTripSnapshot(combined);
  
  HollowTypeReadState typeState = combinedReadStateEngine.getTypeState("TypeA");
  Assert.assertEquals(3, typeState.getPopulatedOrdinals().cardinality());
  
  Assert.assertNull(combinedReadStateEngine.getTypeState("TypeB"));
}

origin: Netflix/hollow

HollowCombiner combiner = new HollowCombiner(roundTrip(sEngine), roundTrip(shard1));
HollowReadStateEngine combinedResult = roundTrip(combiner.getCombinedStateEngine());
Assert.assertEquals(1, extractPrimaryKeys(combinedResult).size());
Assert.assertEquals(pKeys, extractPrimaryKeys(combinedResult));
Assert.assertEquals(oldPK, newPK);
HollowCombiner combiner = new HollowCombiner(roundTrip(sEngine), roundTrip(shard1));
combiner.setPrimaryKeys(newPK);
Assert.assertEquals(1, combiner.getPrimaryKeys().size());
Assert.assertEquals(oldPK, combiner.getPrimaryKeys().get(0));
Assert.assertEquals(newPK, combiner.getPrimaryKeys().get(0));
Assert.assertNotEquals(oldPK, newPK);
HollowCombiner combiner = new HollowCombiner(roundTrip(sEngine), roundTrip(shard1));
combiner.setPrimaryKeys(newPK);
Assert.assertEquals(1, combiner.getPrimaryKeys().size());
Assert.assertNotEquals(oldPK, combiner.getPrimaryKeys().get(0));
Assert.assertEquals(newPK, combiner.getPrimaryKeys().get(0));
Assert.assertNotEquals(oldPK, newPK);
HollowCombiner combiner = new HollowCombiner(roundTrip(sEngine), roundTrip(shard1));
combiner.setPrimaryKeys(newPK);
Assert.assertEquals(2, combiner.getPrimaryKeys().size());
Assert.assertTrue(combiner.getPrimaryKeys().contains(oldPK));
Assert.assertTrue(combiner.getPrimaryKeys().contains(newPK));
origin: Netflix/hollow

final int numThreads = executor.getCorePoolSize();
createOrdinalRemappers();
createHashOrderIndependentOrdinalMaps();
      if(!isAnySelectedPrimaryKeyADependencyOf(key.getType(), selectedPrimaryKeys)) {
        selectedPrimaryKeys.add(key);
      if(selectedPrimaryKeys.isEmpty() || isAnySelectedPrimaryKeyDependentOn(schema.getName(), selectedPrimaryKeys)) {
        for(PrimaryKey pk : selectedPrimaryKeys) {
          if(pk.getType().equals(schema.getName())) {
origin: Netflix/hollow

@Test
public void multipleTypes() throws IOException {
  HollowWriteStateEngine combineInto = new HollowWriteStateEngine();
  HollowObjectMapper mapper = new HollowObjectMapper(combineInto);
  mapper.initializeTypeState(TypeA.class);
  mapper.initializeTypeState(TypeB.class);
  
  HollowWriteStateEngine combineFromWriteEngine1 = new HollowWriteStateEngine();
  mapper = new HollowObjectMapper(combineFromWriteEngine1);
  mapper.add(new TypeB(1));
  HollowReadStateEngine combineFrom1 = StateEngineRoundTripper.roundTripSnapshot(combineFromWriteEngine1);
  HollowWriteStateEngine combineFromWriteEngine2 = new HollowWriteStateEngine();
  mapper = new HollowObjectMapper(combineFromWriteEngine2);
  mapper.add(new TypeB(2));
  mapper.add(new TypeA(2));
  HollowReadStateEngine combineFrom2 = StateEngineRoundTripper.roundTripSnapshot(combineFromWriteEngine2);
  HollowCombiner combiner = new HollowCombiner(combineInto, combineFrom1, combineFrom2);
  combiner.combine();
  
  HollowReadStateEngine combined = StateEngineRoundTripper.roundTripSnapshot(combineInto);
  assertEquals(2, combined.getTypeState("TypeB").getPopulatedOrdinals().cardinality());
  assertEquals(1, combined.getTypeState("TypeA").getPopulatedOrdinals().cardinality());
}

origin: Netflix/hollow

@Test
public void testCompoundKeys() throws IOException {
  HollowCombiner combiner = new HollowCombiner(input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"));
  
  combiner.combine();
  
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  
  assertObject(output, 1, 1, 1, 1, 1, 1);
  assertObject(output, 2, 1, 2, 1, 2, 1);
  assertObject(output, 3, 1, 3, 1, 3, 1);
  assertObject(output, 4, 2, 2, 2, 3, 2);
  assertObject(output, 5, 2, 4, 2, 4, 2);
  assertObject(output, 6, 2, 6, 2, 6, 2);
  assertObject(output, 7, 3, 2, 2, 3, 2);
  assertObject(output, 8, 3, 7, 3, 6, 3);
  assertObject(output, 9, 3, 8, 3, 8, 3);
  assertObject(output, 10,3, 4, 3, 10,3);
}

origin: Netflix/hollow

@Test
public void testCombiner() throws IOException {
  addRecord(shard1, 1, "C1", "C2", "C3");
  addRecord(shard1, 2, "C2", "C3", "C4");
  addRecord(shard1, 3, "C1", "C2", "C3");
  addRecord(shard2, 4, "C2", "C3", "C4");
  addRecord(shard2, 5, "C1", "C4", "C5");
  addRecord(shard2, 6, "C1", "C2", "C3");
  addRecord(shard3, 7, "C4", "C5", "C6");
  HollowCombiner combiner = new HollowCombiner(roundTrip(shard1), roundTrip(shard2), roundTrip(shard3));
  combiner.combine();
  HollowReadStateEngine combinedResult = roundTrip(combiner.getCombinedStateEngine());
  Assert.assertEquals(6, combinedResult.getTypeState("A").maxOrdinal());
  Assert.assertEquals(3, combinedResult.getTypeState("B").maxOrdinal());
  Assert.assertEquals(5, combinedResult.getTypeState("C").maxOrdinal());
  HollowSetTypeReadState bTypeState = (HollowSetTypeReadState)combinedResult.getTypeState("B");
  Assert.assertTrue(setOrderingExists(bTypeState, "C1", "C2", "C3"));
  Assert.assertTrue(setOrderingExists(bTypeState, "C2", "C3", "C4"));
  Assert.assertTrue(setOrderingExists(bTypeState, "C1", "C4", "C5"));
  Assert.assertTrue(setOrderingExists(bTypeState, "C4", "C5", "C6"));
}
origin: Netflix/hollow

@Test
public void testCompoundCascadingKeys() throws IOException {
  HollowCombiner combiner = new HollowCombiner(input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key"));
  
  combiner.combine();
  
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  
  assertObject(output, 1, 1, 1, 1, 1, 1);
  assertObject(output, 2, 1, 2, 1, 2, 1);
  assertObject(output, 3, 1, 3, 1, 3, 1);
  assertObject(output, 4, 2, 2, 2, 3, 1);
  assertObject(output, 5, 2, 4, 2, 4, 2);
  assertObject(output, 6, 2, 6, 2, 6, 2);
  assertObject(output, 7, 3, 2, 2, 3, 1);
  assertObject(output, 8, 3, 7, 3, 6, 2);
  assertObject(output, 9, 3, 8, 3, 8, 3);
  assertObject(output, 10,3, 4, 3, 10,3);
}

origin: Netflix/hollow

@Test
public void testCascadingKeys() throws IOException {
  HollowCombiner combiner = new HollowCombiner(input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key"), new PrimaryKey("TypeC", "key"));
  
  combiner.combine();
  
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  
  assertObject(output, 1, 1, 1, 1, 1, 1);
  assertObject(output, 2, 1, 2, 1, 2, 1);
  assertObject(output, 3, 1, 3, 1, 3, 1);
  assertObject(output, 4, 2, 2, 1, 2, 1);
  assertObject(output, 5, 2, 4, 2, 4, 2);
  assertObject(output, 6, 2, 6, 2, 6, 2);
  assertObject(output, 7, 3, 2, 1, 2, 1);
  assertObject(output, 8, 3, 7, 3, 6, 2);
  assertObject(output, 9, 3, 8, 3, 8, 3);
  assertObject(output, 10,3, 4, 2, 4, 2);
}

origin: Netflix/hollow

@Test
public void testExcludeReferencedObjectsFromPrimaryKeyCopyDirector() throws IOException {
  HollowPrimaryKeyIndex aIdx3 = new HollowPrimaryKeyIndex(input3, "TypeA", "key");
  HollowCombinerExcludePrimaryKeysCopyDirector director = new HollowCombinerExcludePrimaryKeysCopyDirector();
  director.excludeKey(aIdx3, 9);
  HollowCombiner combiner = new HollowCombiner(director, input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key"));
  combiner.combine();
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  
  Assert.assertEquals(-1, new HollowPrimaryKeyIndex(output, "TypeA", "key").getMatchingOrdinal(9));
  Assert.assertNotEquals(-1, new HollowPrimaryKeyIndex(output, "TypeB", "key").getMatchingOrdinal(8));
  Assert.assertNotEquals(-1, new HollowPrimaryKeyIndex(output, "TypeC", "key").getMatchingOrdinal(8));
  
  director.excludeReferencedObjects();
  
  combiner = new HollowCombiner(director, input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key"));
  combiner.combine();
  output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  
  Assert.assertEquals(-1, new HollowPrimaryKeyIndex(output, "TypeA", "key").getMatchingOrdinal(9));
  Assert.assertEquals(-1, new HollowPrimaryKeyIndex(output, "TypeB", "key").getMatchingOrdinal(8));
  Assert.assertEquals(-1, new HollowPrimaryKeyIndex(output, "TypeC", "key").getMatchingOrdinal(8));
}

origin: Netflix/hollow

@Test
public void testExplicitlyExcludedAndRemappedKeys() throws IOException {
  HollowPrimaryKeyIndex cIdx1 = new HollowPrimaryKeyIndex(input1, "TypeC", "key");
  HollowCombinerExcludePrimaryKeysCopyDirector director = new HollowCombinerExcludePrimaryKeysCopyDirector();
  director.excludeKey(cIdx1, 3);
  
  HollowCombiner combiner = new HollowCombiner(director, input1, input2, input3);
  combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key"));
  
  combiner.combine();
  
  HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine());
  assertObject(output, 1, 1, 1, 1, 1, 1);
  assertObject(output, 2, 1, 2, 1, 2, 1);
  assertObject(output, 3, 1, 3, 1, 3, 2);
  assertObject(output, 4, 2, 2, 2, 3, 2);
  assertObject(output, 5, 2, 4, 2, 4, 2);
  assertObject(output, 6, 2, 6, 2, 6, 2);
  assertObject(output, 7, 3, 2, 2, 3, 2);
  assertObject(output, 8, 3, 7, 3, 6, 2);
  assertObject(output, 9, 3, 8, 3, 8, 3);
  assertObject(output, 10,3, 4, 3, 10,3);
}

com.netflix.hollow.tools.combineHollowCombiner

Javadoc

The HollowCombiner is used to copy data from one or more copies of hollow datasets (a HollowReadStateEngine) into a single hollow dataset (a HollowWriteStateEngine).

By default, a HollowCombiner will copy all records from each provided HollowReadStateEngine into the destination.

A HollowCombinerCopyDirector can be provided, which will specify which specific ordinals to include/exclude while copying.

A set of PrimaryKey can be provided, which will ensure that no duplicate records, as defined by any of the provided keys, will be added to the destination state.

Most used methods

  • <init>
  • combine
    Perform the combine operation.
  • getCombinedStateEngine
  • addIgnoredTypes
    Specify a set of types not to copy. Be careful: if any included types reference any of the specified
  • copyOrdinal
  • createHashOrderIndependentOrdinalMaps
  • createOrdinalRemappers
  • getAllTypesWithDefinedHashCodes
  • getPrimaryKeys
  • initializePrimaryKeys
  • isAnySelectedPrimaryKeyADependencyOf
  • isAnySelectedPrimaryKeyDependentOn
  • isAnySelectedPrimaryKeyADependencyOf,
  • isAnySelectedPrimaryKeyDependentOn,
  • isDefinedHashCode,
  • setPrimaryKeys,
  • sortPrimaryKeys

Popular in Java

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Runner (org.openjdk.jmh.runner)
  • Option (scala)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now