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/11/24 15:39:00 UTC
[jira] [Resolved] (HIVE-25721) Outer join result is wrong
[ https://issues.apache.org/jira/browse/HIVE-25721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zoltan Haindrich resolved HIVE-25721.
-------------------------------------
Resolution: Fixed
merged into master. Thank you [~sparksfyz] for fixing this!
> Outer join result is wrong
> --------------------------
>
> Key: HIVE-25721
> URL: https://issues.apache.org/jira/browse/HIVE-25721
> Project: Hive
> Issue Type: Bug
> Components: HiveServer2
> Affects Versions: All Versions
> Reporter: Yizhen Fan
> Assignee: Yizhen Fan
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Attachments: HIVE-25721.patch
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> Outer Join results is wrong, here is a left join case.
> select b.fields from a left join b on a.key=b.key and a.filter=xxx
> there are some necessary condition to produce this problem:
> # `select` clause only contains right table fields
> # `on` clause contains left table condition, and this condition can filter records
> h3. cause:
> candidateStorage[tag].addRow(value); // CommonMergeJoinOperator.process
> row of left table cannot be add into row container because tblDesc of left table is null, while left table data can not be ignored in this case.
> h3. Reproducible steps are mentioned below.
> --------------------------------------------
> set hive.auto.convert.join=false;
> create table t_smj_left (key string, value int);
> insert into t_smj_left values
> ('key1', 1),
> ('key1', 2);
> create table t_smj_right (key string, value int);
> insert into t_smj_right values
> ('key1', 1);
> select
> t2.value
> from t_smj_left t1
> left join t_smj_right t2 on t1.key=t2.key and t1.value=2;
>
> Result:
> ----------------------------+
> NULL
> NULL
> ----------------------------+
> Expected Output:
> ----------------------------+
> 1
> NULL
> ----------------------------+
--
This message was sent by Atlassian Jira
(v8.20.1#820001)