[ 
https://issues.apache.org/jira/browse/HIVE-20417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585025#comment-16585025
 ] 

Ashutosh Chauhan commented on HIVE-20417:
-----------------------------------------

Couldn't find anything in standard so I checked on few other DBs. Surprisingly, 
mysql and oracle has same behavior as Hive for {{c1.i + c2.i}} However they 
throw exception for {{c1.i + ' ' + c2.i}} Postgres throws for both. Sql server 
does string concat in both cases. Personally, I liked sql server behavior and 
expected that behavior. However, since standard doesnt say anything on this 
topic (maybe it did but I couldnt find it) and few other DBs do exhibit same 
behavior, I think there is no need to change anything for Hive. For second 
case, throwing exception is an option but historically Hive has chosen to 
return null instead of exception in such ambiguous cases. 
So, I will say this is "working as designed".

> Hive converts strings to doubles in a strange manner
> ----------------------------------------------------
>
>                 Key: HIVE-20417
>                 URL: https://issues.apache.org/jira/browse/HIVE-20417
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>            Assignee: Matt McCline
>            Priority: Major
>
> This is not on master, but on a close enough version, so it needs to be dbl 
> checked... running with vectorization on:
> {noformat}
> POSTHOOK: query: create table cross_numbers(i string)
> POSTHOOK: query: insert into table cross_numbers select key from src limit 20
> POSTHOOK: query: select c1.i, c2.i, c1.i + c2.i, c1.i + '' + c2.i from 
> cross_numbers c1 cross join cross_numbers c2
> 401   265     666.0   NULL
> 401   255     656.0   NULL
> 401   165     566.0   NULL
> {noformat}
> Why are strings added as numbers, and string + '' + string converted to null 
> is not clear..
> [~ashutoshc] is plus supposed to work for string?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to