public void finish() { IntMapEntryIterator iter = addedOrdinalMap.iterator(); while(iter.next()) { if(removedOrdinalMap.get(iter.getKey()) != -1) numberOfModifiedRecords++; } numberOfNewRecords = addedOrdinalMap.size() - numberOfModifiedRecords; numberOfRemovedRecords = removedOrdinalMap.size() - numberOfModifiedRecords; }
/** * @param diffPairIdx a number from 0-n, where n is the value returned from numDiffs * @return the to ordinal for the (diffPairIdx)th record pair in which there were differences for this field. */ public int getToOrdinal(int diffPairIdx) { return diffToOrdinals.get(diffPairIdx); }
/** * @return the number of records which had at least one diff for this field. */ public int getNumDiffs() { return diffToOrdinals.size(); }
private IntMap remapPreviousOrdinalMapping(IntMap previousOrdinalMapping, String typeName, OrdinalRemapper ordinalRemapper) { IntMapEntryIterator ordinalMappingIter = previousOrdinalMapping.iterator(); IntMap ordinalLookupMap = new IntMap(previousOrdinalMapping.size()); while(ordinalMappingIter.next()) ordinalLookupMap.put(ordinalRemapper.getMappedOrdinal(typeName, ordinalMappingIter.getKey()), ordinalMappingIter.getValue()); return ordinalLookupMap; }
/** * Populate the provided {@link HollowReadStateEngine} with the dataset currently in the provided {@link HollowWriteStateEngine} * * @param writeEngine the write state engine * @param readEngine the read state engine * @throws IOException if the round trip from write to read state failed */ public static void roundTripSnapshot(HollowWriteStateEngine writeEngine, HollowReadStateEngine readEngine) throws IOException { roundTripSnapshot(writeEngine, readEngine, null); }
public HollowDiffMatcher(HollowObjectTypeReadState fromTypeState, HollowObjectTypeReadState toTypeState) { this.matchPaths = new ArrayList<String>(); this.fromTypeState = fromTypeState; this.toTypeState = toTypeState; this.matchedOrdinals = new LongList(); this.extraInFrom = new IntList(); this.extraInTo = new IntList(); }
public int get(int key) { int bucket = hashKey(key) % keys.length; while (keys[bucket] != -1) { if (keys[bucket] == key) return values[bucket]; bucket++; if (bucket == keys.length) bucket = 0; } return -1; }
/** * @param diffPairIdx a number from 0-n, where n is the value returned from numDiffs * @return the score of the diff for this field in the (diffPairIdx)th record pair in which there were differences for this field. */ public int getPairScore(int diffPairIdx) { return diffPairScores.get(diffPairIdx); }
public DiffEqualOrdinalFilter(DiffEqualOrdinalMap equalityMapping) { this.equalOrdinalMap = equalityMapping; this.matchedFromOrdinals = new IntList(); this.matchedToOrdinals = new IntList(); this.unmatchedFromOrdinals = new IntList(); this.unmatchedToOrdinals = new IntList(); this.hashedIdentityOrdinals = new int[0]; this.hashedIdentityOrdinalsCounts = new int[0]; this.matchedOrdinalsCounts = new int[0]; }
/** * @param diffPairIdx a number from 0-n, where n is the value returned from numDiffs * @return the from ordinal for the (diffPairIdx)th record pair in which there were differences for this field. */ public int getFromOrdinal(int diffPairIdx) { return diffFromOrdinals.get(diffPairIdx); }
public TraversalTreeBuilder(HollowDataAccess dataAccess, String type, String[] fieldPaths) { this.dataAccess = dataAccess; this.type = type; this.fieldPaths = fieldPaths; this.fieldMatchLists = new IntList[fieldPaths.length]; for(int i=0;i<fieldPaths.length;i++) fieldMatchLists[i] = new IntList(); this.fieldTypeDataAccess = new HollowTypeDataAccess[fieldPaths.length]; this.fieldSchemaPositions = new int[fieldPaths.length]; }
public int next() { int nextVal = pivotedToOrdinalClusters.get(currentMatchListPosition++); exhausted = (nextVal & Integer.MIN_VALUE) != 0; return nextVal & Integer.MAX_VALUE; }