[WIP]: HIVE-30043: Fix ClassCastException in FULL OUTER MapJoin with dynamic partitioned hash join - #6796
Open
Indhumathi27 wants to merge 1 commit into
Open
[WIP]: HIVE-30043: Fix ClassCastException in FULL OUTER MapJoin with dynamic partitioned hash join#6796Indhumathi27 wants to merge 1 commit into
Indhumathi27 wants to merge 1 commit into
Conversation
… partitioned hash join
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What changes were proposed in this pull request?
MapJoinDesc#getExprs() caches small-table value column names at compile time. For a FULL OUTER MapJoin using a dynamic partitioned hash join, a filter-tag value column can be appended to the small table's runtime value struct after that caching happens, shifting the positions of the columns that follow it. The cached column name then resolves to the wrong runtime field (and object inspector), producing a type mismatch on read.
This adds MapJoinOperator#correctSmallTableValueObjectInspectors(), invoked once from initializeOp() for FULL OUTER dynamic partitioned hash joins. It uses MapJoinDesc#getValueIndex(alias)
— a positional accessor into the same runtime struct that isn't affected by the shift — to correct the small table's field object inspectors in joinValuesStandardObjectInspectors (and, transitively, outputObjInspector), so downstream operators see the corrected types.
Since not every small-table alias in this join shape is guaranteed to have a ReduceSink KEY/VALUE-struct layout, the new getSmallTableStructFieldOI helper checks field existence via getAllStructFieldRefs() before use, rather than relying on StructObjectInspector#getStructFieldRef, which throws instead of returning null when the field isn't found.
Why are the changes needed?
Without this fix, the described query shape throws ClassCastException: LongWritable cannot be cast to ShortWritable (or an equivalent Writable type mismatch) during MapJoinOperator#closeOp → generateFullOuterSmallTableNoMatches, failing the query.
Does this PR introduce any user-facing change?
No
How was this patch tested?
test case added