Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRILL-8513: Right Hash Join with empty Left table ruturns 0 result #2952

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rymarm
Copy link
Member

@rymarm rymarm commented Oct 14, 2024

DRILL-8513: Right Hash Join with empty Left table ruturns 0 result

Description

Drill returns no results on the right Hash Join if the probe(left) table is empty.

The root cause is simple. Stack-trace of the point of failure:

changeToFinalProbeState:123, HashJoinProbeTemplate (org.apache.drill.exec.physical.impl.join)
setup:105, ProbeTemplate (org.apache.drill.exec.physical.impl.join) <---- The issue comes from here. Because the changeToFinalProbeState() is called before all necessary variables are initialized by the HashJoinProbeTemplate#setup() method.  
setup:45, HashJoinProbeTemplate (org.apache.drill.exec.physical.impl.join) 
setupProbe:108, HashJoinBatch (org.apache.drill.exec.physical.impl.join)
innerNext:585, AbstractHashBinaryRecordBatch (org.apache.drill.exec.physical.impl.join)

HashJoinProbeTemplate#setup() calls it's super #setup() before joinType set and it makes #changeToFinalProbeState() set incorrect ProbeState. This code change comes from #2599

The solution is as simple as the bug: to call ProbeTemplate#setup() at the end of HashJoinProbeTemplate#setup().

Documentation

-

Testing

New unit test with an empty left input for HashJoin.

@rymarm rymarm self-assigned this Oct 14, 2024
@rymarm rymarm added the bug label Oct 14, 2024
Copy link
Contributor

@cgivre cgivre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants