public static int getDecisivePrefixLength(INormalizedKeyComputerFactory[] keyNormalizerFactories) { if (keyNormalizerFactories == null) { return 0; } for (int i = 0; i < keyNormalizerFactories.length; i++) { if (!keyNormalizerFactories[i].getNormalizedKeyProperties().isDecisive()) { return i; } } return keyNormalizerFactories.length; }
public static int[] createNormalizedKeyArray(INormalizedKeyComputer normalizer) { if (normalizer == null) { return null; //NOSONAR } return new int[normalizer.getNormalizedKeyProperties().getNormalizedKeyLength()]; }
public AWrappedDescNormalizedKeyComputerFactory(INormalizedKeyComputerFactory nkcf) { this.nkcf = nkcf; this.normalizedKeyLength = nkcf.getNormalizedKeyProperties().getNormalizedKeyLength(); }
protected static IBinaryComparator[] createBinaryComparators(IBinaryComparatorFactory[] factories) { IBinaryComparator[] comparators = new IBinaryComparator[factories.length]; for (int i = 0; i < factories.length; i++) { comparators[i] = factories[i].createBinaryComparator(); } return comparators; }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException { return -comparator.compare(b1, s1, l1, b2, s2, l2); } };
@Override public int getFieldCount() { return recordDescriptor.getFieldCount(); } }
public FixedSizeElementInvertedListBuilder(ITypeTraits[] invListFields) { int tmp = 0; for (int i = 0; i < invListFields.length; i++) { tmp += invListFields[i].getFixedLength(); } listElementSize = tmp; }
@Override public INormalizedKeyProperties getNormalizedKeyProperties() { return nkc.getNormalizedKeyProperties(); } };
@Override public IBinaryHashFunction createBinaryHashFunction() { // Actual numeric type promotion happens in the createBinaryHashFunction() return AMurmurHash3BinaryHashFunctionFamily.INSTANCE.createBinaryHashFunction(0); } };
@Override public void normalize(byte[] bytes, int start, int length, int[] normalizedKeys, int keyStart) { // normalize msb nkc.normalize(bytes, start, length, normalizedKeys, keyStart); // normalize lsb nkc.normalize(bytes, start + Long.BYTES, length - Long.BYTES, normalizedKeys, keyStart + int64NormalizedKeyLength); }
@Override public int partition(IFrameTupleAccessor accessor, int tIndex, int nParts) throws HyracksDataException { return delegate.partition(accessor, tIndex, factor * nParts) / factor; } };
private boolean evaluatePredicate(int tIx1, int tIx2) { if (reverseOutputOrder) { //Role Reversal Optimization is triggered return (predEvaluator == null) || predEvaluator.evaluate(accessorBuild, tIx2, accessorProbe, tIx1); } else { return (predEvaluator == null) || predEvaluator.evaluate(accessorProbe, tIx1, accessorBuild, tIx2); } }
private int compare(FrameTupleAccessor accessor0, int tIndex0, FrameTupleAccessor accessor1, int tIndex1) throws HyracksDataException { int c = tpComparator.compare(accessor0, tIndex0, accessor1, tIndex1); if (c != 0) { return c; } return 0; }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException { return -bc.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1); } };
public FixedSizeFrameTupleAppender(int frameSize, ITypeTraits[] fields) { this.frameSize = frameSize; int tmp = 0; for (int i = 0; i < fields.length; i++) { tmp += fields[i].getFixedLength(); } tupleSize = tmp; }
public ReferenceEntry(int runid, FrameTupleAccessor fta, int tupleIndex, int[] keyFields, INormalizedKeyComputer nmkComputer) { super(); this.runid = runid; this.acccessor = fta; this.normalizedKeyLength = nmkComputer != null ? nmkComputer.getNormalizedKeyProperties().getNormalizedKeyLength() : 0; this.tPointers = new int[normalizedKeyLength + 2 * keyFields.length]; if (fta != null) { initTPointer(fta, tupleIndex, keyFields, nmkComputer); } }
@Override public void normalize(byte[] bytes, int start, int length, int[] normalizedKeys, int keyStart) { nkc.normalize(bytes, start + 1, length - 1, normalizedKeys, keyStart); for (int i = 0; i < normalizedKeyLength; i++) { int key = normalizedKeys[keyStart + i]; normalizedKeys[keyStart + i] = ~key; } }
private boolean evaluatePredicate(int tIx1, int tIx2) { if (isReversed) { //Role Reversal Optimization is triggered return ((predEvaluator == null) || predEvaluator.evaluate(accessorInner, tIx2, accessorOuter, tIx1)); } else { return ((predEvaluator == null) || predEvaluator.evaluate(accessorOuter, tIx1, accessorInner, tIx2)); } }
public FixedSizeTupleReference(ITypeTraits[] typeTraits) { this.typeTraits = typeTraits; this.fieldStartOffsets = new int[typeTraits.length]; this.fieldStartOffsets[0] = 0; for (int i = 1; i < typeTraits.length; i++) { fieldStartOffsets[i] = fieldStartOffsets[i - 1] + typeTraits[i - 1].getFixedLength(); } }
@Override public void normalize(byte[] bytes, int start, int length, int[] normalizedKeys, int keyStart) { // start +1, length -1 is because in ASTERIX data format, there is always a type tag before the value nkc.normalize(bytes, start + 1, length - 1, normalizedKeys, keyStart); }