I noticed that on Apache Impala (version 3.4.0), 32767 + 0 returns an integer, whereas 32768 + 0 returns a bigint. I’m curious to know if this is expected (i.e. not a bug in my version of Impala), and if so, what is the reason?
I was expecting 32768 + 0 to return an integer (not a bigint). Of course 32767 is the the maximum value of a 16-bit signed integer, but if I execute select 32768
it still returns an integer (not a bigint). So it seems the addition operator is playing a role in the promotion to bigint.