class BytesRefColumnReference extends LuceneCollectorExpression<String> {

    private final String columnName;
    private SortedBinaryDocValues values;
    private int docId;

    public BytesRefColumnReference(String columnName) {
        this.columnName = columnName;
    }

    @Override
    public String value() throws ArrayViaDocValuesUnsupportedException {<FILL_FUNCTION_BODY>}

    @Override
    public void setNextDocId(int docId) {
        this.docId = docId;
    }

    @Override
    public void setNextReader(ReaderContext context) throws IOException {
        super.setNextReader(context);
        values = FieldData.toString(DocValues.getSortedSet(context.reader(), columnName));
    }
}

        try {
            if (values.advanceExact(docId)) {
                if (values.docValueCount() == 1) {
                    return values.nextValue().utf8ToString();
                } else {
                    throw new ArrayViaDocValuesUnsupportedException(columnName);
                }
            } else {
                return null;
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    
<methods>public void setNextDocId(int) ,public void setNextReader(io.crate.execution.engine.fetch.ReaderContext) throws java.io.IOException,public void setScorer(Scorable) ,public void startCollect(io.crate.expression.reference.doc.lucene.CollectorContext) <variables>