hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Satoshi Iijima (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-16241) When PTF, explode AND join are used together, result is duplicated
Date Fri, 17 Mar 2017 12:44:41 GMT
Satoshi Iijima created HIVE-16241:
-------------------------------------

             Summary: When PTF, explode AND join are used together, result is duplicated 
                 Key: HIVE-16241
                 URL: https://issues.apache.org/jira/browse/HIVE-16241
             Project: Hive
          Issue Type: Bug
          Components: PTF-Windowing, Query Processor
    Affects Versions: 2.1.0
            Reporter: Satoshi Iijima


Example:
{code}
CREATE TABLE test (
  key   STRING,
  type  STRING,
  value INT
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

LOAD DATA LOCAL INPATH '/tmp/test.gz' OVERWRITE INTO TABLE test;

SELECT * FROM test;

A	type1	30000
B	type2	20000
C	type2	5000

SELECT l.*
FROM (
  SELECT * FROM test LATERAL VIEW explode(ARRAY(key)) e AS dammy
) l JOIN (
    SELECT key, rank() OVER (PARTITION BY type ORDER BY value DESC) rank 
    FROM test
) r ON l.key = r.key

A	type1	30000	A
A	type1	30000	A
B	type2	20000	B
B	type2	20000	B
C	type2	5000	C
C	type2	5000	C
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message