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 RunMergingFrameReader(IHyracksTaskContext ctx, List<? extends IFrameReader> runs, List<? extends IFrame> inFrames, int[] sortFields, IBinaryComparator[] comparators, INormalizedKeyComputer nmkComputer, RecordDescriptor recordDesc, int topK) { this.ctx = ctx; this.runCursors = runs; this.inFrames = inFrames; this.sortFields = sortFields; this.comparators = comparators; this.nmkComputer = nmkComputer; this.normalizedKeyLength = nmkComputer != null ? nmkComputer.getNormalizedKeyProperties().getNormalizedKeyLength() : 0; // right now we didn't take multiple key normalizers for frame merger, since during this step it won't be // too many cache misses (merging multiple runs sequentially). // but still, we can apply a special optimization if there is only 1 sort field this.normalizedKeyDecisive = nmkComputer != null ? nmkComputer.getNormalizedKeyProperties().isDecisive() && comparators.length == 1 : false; this.recordDesc = recordDesc; this.topK = topK; }
firstKeyNormalizerFactory != null ? firstKeyNormalizerFactory.createNormalizedKeyComputer() : null; this.normalizedKeyDecisive = firstKeyNormalizerFactory != null ? firstKeyNormalizerFactory.getNormalizedKeyProperties().isDecisive() && compareFields[0].length == 1 : false;