presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/decoders/TinyintDecoder.java/TinyintDecoder/decode
class TinyintDecoder:    @Override
    public void decode(SearchHit hit, Supplier<Object> getter, BlockBuilder output)
    {
        Object value = getter.get();
        if (value == null) {
            output.appendNull();
        }
        else if (value instanceof Number) {
            long decoded = ((Number) value).longValue();

            if (decoded < Byte.MIN_VALUE || decoded > Byte.MAX_VALUE) {
                throw new PrestoException(TYPE_MISMATCH, "Value out of range for TINYINT field");
            }

            TINYINT.writeLong(output, decoded);
        }
        else {
            throw new PrestoException(TYPE_MISMATCH, "Expected a numeric value for SMALLINT field");
        }
    }