class ByteColumnReference extends LuceneCollectorExpression<Byte> {

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

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

    @Override
    public Byte value() {<FILL_FUNCTION_BODY>}

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

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

        try {
            if (values.advanceExact(docId)) {
                switch (values.docValueCount()) {
                    case 1:
                        return (byte) values.nextValue();

                    default:
                        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>