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

Rajkumar Singh commented on HIVE-20275:
---------------------------------------

verified the same repro steps with hive2, which indeed return the expected 
results.

> hive produces incorrect result when using MIN()/MAX() on varchar with 
> hive.vectorized.reuse.scratch.columns enabled
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-20275
>                 URL: https://issues.apache.org/jira/browse/HIVE-20275
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 3.1.0
>         Environment: Hive3.1,java8
>            Reporter: Rajkumar Singh
>            Priority: Major
>
> Steps to reproduce:
> {code}
> create table testhive3 (name varchar(8), `time` double);
>  insert into table testhive3 values
>  ('ABC', 1),
>  ('ABC', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ('ABC', 1),
>  ('ABC', 2),
>  ('DEF', 1),
>  ('DEF', 2),
>  ( 'ABC', 1),
>  ( NULL, NULL),
>  ( 'ABC', 1),
>  ( 'ABC', 2),
>  ( 'DEF', 1),
>  ('DEF', 2),
>  ('ABC', 1),
>  ( 'ABC', 2),
>  ('ABC', 1),
>  ( 'ABC', 2),
>  ( 'DEF', 1),
>  ('DEF', 2);
>  select name, `time` from testhive3 where name = 'ABC' group by name, `time`;
>  +-------+-------+
> | name  | time  |
> +-------+-------+
> | ABC   | 1.0   |
> | ABC   | 2.0   |
> +-------+-------+
>  select min(name), `time` from testhive3 where name = 'ABC' group by name, 
> `time`;
>  +-------+-------+
> |  _c0  | time  |
> +-------+-------+
> | NULL  | 1.0   |
> | NULL  | 2.0   |
> +-------+-------+
> set hive.vectorized.reuse.scratch.columns=false;
> select min(name), `time` from testhive3 where name = 'ABC' group by name, 
> `time`;
> +------+-------+
> | _c0  | time  |
> +------+-------+
> | ABC  | 1.0   |
> | ABC  | 2.0   |
> +------+-------+
> {code}



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

Reply via email to