presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/decoders/SmallintDecoder.java/SmallintDecoder/decode
class SmallintDecoder:    @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 < Short.MIN_VALUE || decoded > Short.MAX_VALUE) {
                throw new PrestoException(TYPE_MISMATCH, "Value out of range for SMALLINT field");
            }

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