[ 
https://issues.apache.org/jira/browse/HIVE-18605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Shelukhin updated HIVE-18605:
------------------------------------
    Description: 
{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);
> 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.

  was:
{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.


> 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
>            Priority: Major
>
> {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);
> > 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