[ https://issues.apache.org/jira/browse/HIVE-8298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152687#comment-14152687 ]
Ashutosh Chauhan commented on HIVE-8298: ---------------------------------------- Issue is that while merging this n-way join we copied expressions from one join tree into another without paying attention to fact that they could be in different order. There are two workarounds for it: * Introduce any udf on join condition like cast column to string. * Rewrite the query so that expressions are in same order in two join. First one disables the join merge altogether, thereby avoiding buggy code-path. So, it will avoid the bug but will result in 2 jobs and thereby suboptimal performance. Second one is a better workaround since join merging will still happen, but since original order of expressions is maintained, bug doesn't kick in. > Incorrect results for n-way join when join expressions are not in same order > across joins > ----------------------------------------------------------------------------------------- > > Key: HIVE-8298 > URL: https://issues.apache.org/jira/browse/HIVE-8298 > Project: Hive > Issue Type: Bug > Components: Logical Optimizer > Affects Versions: 0.13.0, 0.13.1 > Reporter: Ashutosh Chauhan > Assignee: Ashutosh Chauhan > Priority: Blocker > > select count( * ) from srcpart a join srcpart b on a.key = b.key and a.hr = > b.hr join srcpart c on a.hr = c.hr and a.key = c.key; > is minimal query which reproduces it -- This message was sent by Atlassian JIRA (v6.3.4#6332)