You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Zoltan Haindrich (Jira)" <ji...@apache.org> on 2021/04/08 10:37:00 UTC
[jira] [Comment Edited] (HIVE-24963) Windowing expression may loose
its input in some cases
[ https://issues.apache.org/jira/browse/HIVE-24963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17312437#comment-17312437 ]
Zoltan Haindrich edited comment on HIVE-24963 at 4/8/21, 10:36 AM:
-------------------------------------------------------------------
the issue only happens when the plan is not converted to sort-merge-join - and both ptf operators are placed inside the same vertex
was (Author: kgyrtkirk):
the issue only happens when the plan is not converted to mapjoin - and both ptf operators are placed inside the same vertex
> Windowing expression may loose its input in some cases
> ------------------------------------------------------
>
> Key: HIVE-24963
> URL: https://issues.apache.org/jira/browse/HIVE-24963
> Project: Hive
> Issue Type: Bug
> Reporter: Zoltan Haindrich
> Assignee: Zoltan Haindrich
> Priority: Major
> Attachments: mapjoin.png, mergejoin.png
>
>
> {code}
> drop table if exists sss;
> CREATE TABLE `sss`(
> `user_id` bigint,
> `user_mid` string
> )
> PARTITIONED BY (
> `dt` string)
> STORED AS ORC
> ;
> insert into sss partition(dt='part1') VALUES (12345,'user_mid v1'),(12345,'user_mid v1'),(12345,'user_mid v1'),(12345,'user_mid v1'),(12345,'user_mid v1');
> set hive.auto.convert.join.noconditionaltask.size=1;
> WITH
> unioned_user AS (
> SELECT
> *,
> row_number() OVER (PARTITION BY user_mid ORDER BY dt ASC) AS r_asc,
> row_number() OVER (PARTITION BY user_mid ORDER BY dt DESC) AS r_desc
> FROM (
> SELECT DISTINCT
> dt,
> user_mid
> FROM sss
> WHERE dt = '20210228'
> UNION ALL
> SELECT DISTINCT
> dt,
> user_mid
> FROM sss
> ) AS uni
> ),
> merged_user AS (
> SELECT
> a.user_mid
> FROM (SELECT * FROM unioned_user WHERE r_asc = 1) AS a
> INNER JOIN (SELECT * FROM unioned_user WHERE r_desc = 1) AS d
> ON a.user_mid = d.user_mid
> )
> Select count(*) from merged_user;
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)