@Override public double nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } }
@Override public long nextValue() throws IOException { return (long) values.nextValue(); }
@Override protected double pick(SortedNumericDoubleValues values) throws IOException { return values.nextValue(); }
@Override protected double pick(SortedNumericDoubleValues values) throws IOException { int count = values.docValueCount(); for (int i = 0; i < (count - 1) / 2; ++i) { values.nextValue(); } if (count % 2 == 0) { return (values.nextValue() + values.nextValue()) / 2; } else { return values.nextValue(); } } },
@Override public double nextValue() throws IOException { return Math.floor(values.nextValue() / interval) * interval; }
@Override protected double pick(SortedNumericDoubleValues values) throws IOException { final int count = values.docValueCount(); double total = 0; for (int index = 0; index < count; ++index) { total += values.nextValue(); } return total / count; }
@Override public void get(List<CharSequence> list) throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { list.add(Double.toString(values.nextValue())); } } });
@Override public long nextValue() throws IOException { return BitMixer.mix64(java.lang.Double.doubleToLongBits(values.nextValue())); } }
@Override protected double pick(SortedNumericDoubleValues values) throws IOException { final int count = values.docValueCount(); double total = 0; for (int index = 0; index < count; ++index) { total += values.nextValue(); } return total; }
@Override public long nextValue() throws IOException { return NumericUtils.doubleToSortableLong(values.nextValue()); }
@Override protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { boolean hasValue = false; double minValue = Double.POSITIVE_INFINITY; int count = 0; for (int doc = startDoc; doc < endDoc; doc = docItr.nextDoc()) { if (values.advanceExact(doc)) { if (++count > maxChildren) { break; } minValue = Math.min(minValue, values.nextValue()); hasValue = true; } } return hasValue ? minValue : missingValue; }
@Override public boolean advanceExact(int docId) throws IOException { if (doubleValues.advanceExact(docId)) { int n = doubleValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { values[i] = Math.max(0.0d, Math.abs(doubleValues.nextValue() - origin) - offset); } sort(); return true; } else { return false; } } }), 0);
@Override public void collect(int doc, long bucket) throws IOException { if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); for (int i = 0, lo = 0; i < valuesCount; ++i) { final double value = values.nextValue(); lo = collect(doc, value, bucket, lo); } } }
@Override public void setNextDocId(int docId) throws IOException { if (in.advanceExact(docId)) { resize(in.docValueCount()); for (int i = 0; i < count; i++) { values[i] = in.nextValue(); } } else { resize(0); } }
@Override protected double pick(SortedNumericDoubleValues values, double missingValue, DocIdSetIterator docItr, int startDoc, int endDoc, int maxChildren) throws IOException { int totalCount = 0; double totalValue = 0; int count = 0; for (int doc = startDoc; doc < endDoc; doc = docItr.nextDoc()) { if (values.advanceExact(doc)) { if (++count > maxChildren) { break; } final int docCount = values.docValueCount(); for (int index = 0; index < docCount; ++index) { totalValue += values.nextValue(); } totalCount += docCount; } } return totalCount > 0 ? totalValue : missingValue; } },
@Override public void collect(int doc, long bucket) throws IOException { if (dvs.advanceExact(doc)) { int num = dvs.docValueCount(); for (int i = 0; i < num; i++) { currentValue = dvs.nextValue(); missingCurrentValue = false; next.collect(doc, bucket); } } else if (missingBucket) { missingCurrentValue = true; next.collect(doc, bucket); } } };
@Override public void collect(int doc, long bucket) throws IOException { states = bigArrays.grow(states, bucket + 1); TDigestState state = states.get(bucket); if (state == null) { state = new TDigestState(compression); states.set(bucket, state); } if (values.advanceExact(doc)) { final int valueCount = values.docValueCount(); for (int i = 0; i < valueCount; i++) { state.add(values.nextValue()); } } } };
@Override public void collect(int doc, long bucket) throws IOException { valueSketches = bigArrays.grow(valueSketches, bucket + 1); TDigestState valueSketch = valueSketches.get(bucket); if (valueSketch == null) { valueSketch = new TDigestState(compression); valueSketches.set(bucket, valueSketch); } if (values.advanceExact(doc)) { final int valueCount = values.docValueCount(); for (int i = 0; i < valueCount; i++) { final double value = values.nextValue(); valueSketch.add(value); } } } };
@Override public boolean advanceExact(int target) throws IOException { if (doubleValues.advanceExact(target)) { resize(doubleValues.docValueCount()); script.setDocument(target); for (int i = 0; i < docValueCount(); ++i) { script.setNextAggregationValue(doubleValues.nextValue()); values[i] = script.runAsDouble(); } sort(); return true; } return false; } }