class SortedNumericDocValueAggregator<T> implements DocValueAggregator<T> {

    private final String columnName;
    private final TriFunction<RamAccounting, MemoryManager, Version, T> stateInitializer;
    private final CheckedBiConsumer<SortedNumericDocValues, T, IOException> docValuesConsumer;

    private SortedNumericDocValues values;

    public SortedNumericDocValueAggregator(String columnName,
                                           TriFunction<RamAccounting, MemoryManager,Version, T> stateInitializer,
                                           CheckedBiConsumer<SortedNumericDocValues, T, IOException> docValuesConsumer) {
        this.columnName = columnName;
        this.stateInitializer = stateInitializer;
        this.docValuesConsumer = docValuesConsumer;
    }

    @Override
    public T initialState(RamAccounting ramAccounting, MemoryManager memoryManager, Version version) {
        return stateInitializer.apply(ramAccounting, memoryManager, version);
    }

    @Override
    public void loadDocValues(LeafReaderContext reader) throws IOException {
        values = DocValues.getSortedNumeric(reader.reader(), columnName);
    }

    @Override
    public void apply(RamAccounting ramAccounting, int doc, T state) throws IOException {<FILL_FUNCTION_BODY>}

    @Nullable
    @Override
    public Object partialResult(RamAccounting ramAccounting, T state) {
        return state;
    }
}

        if (values.advanceExact(doc) && values.docValueCount() == 1) {
            docValuesConsumer.accept(values, state);
        }
    
<no_super_class>