Fix overflow error on int/date compare

Added unit tests and applied formatting to avoid CheckStyle violations