Sergey Shelukhin created HIVE-18605:
---------------------------------------

             Summary: text and int compares can produce surprising results
                 Key: HIVE-18605
                 URL: https://issues.apache.org/jira/browse/HIVE-18605
             Project: Hive
          Issue Type: Bug
            Reporter: Ankita Kapratwar


{noformat}
create table foo (i int) STORED AS. . . . . . . . . . . . . . . . . . . . . . 
.>   INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'. . . . . . . . . . 
. . . . . . . . . . . . .>   OUTPUTFORMAT 
'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat';

> insert into foo values (1);
> create table foo (i int) STORED AS. . . . . . . . . . . . . . . . . . . . . . 
> .>   INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'. . . . . . . . . 
> . . . . . . . . . . . . . .>   OUTPUTFORMAT 
> 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat';

> insert into foo values (1);
> select * from foo where i != 'foo';
+--------+
| foo.i  |
+--------+
+--------+
No rows selected (0.562 seconds)
> select * from foo where i != '2';
+--------+
| foo.i  |
+--------+
| 1      |
+--------+
{noformat}

This can be worked around with an explicit cast to string.
Double is used as a common type according to [~ashutoshc].
Seems like if this is the case, there should be a failure when converting foo 
to double.



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

Reply via email to