Jason Dere created HIVE-17782:
---------------------------------
Summary: Inconsistent cast behavior from string to numeric types
with regards to leading/trailing spaces
Key: HIVE-17782
URL: https://issues.apache.org/jira/browse/HIVE-17782
Project: Hive
Issue Type: Bug
Components: Types
Reporter: Jason Dere
Assignee: Jason Dere
{noformat}
select cast(' 1 ' as tinyint), cast(' 1 ' as smallint), cast(' 1 ' as int),
cast(' 1 ' as bigint), cast(' 1 ' as float), cast(' 1 ' as double), cast(' 1 '
as decimal(10,2))
NULL NULL NULL NULL 1.0 1.0 1
{noformat}
Looks like integer types (short, int, etc) fail the conversion due to the
leading/trailing spaces and return NULL, while float/double/decimal do not. In
fact, Decimal used to also return NULL in previous versions up until HIVE-10799.
Let's try to make this behavior consistent across all of these types, should be
simple enough to strip spaces before passing to number formatter.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)