Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17806] [SQL] fix bug in join key rewritten in HashJoin - #15390
Closed
davies wants to merge 2 commits into
Closed
[SPARK-17806] [SQL] fix bug in join key rewritten in HashJoin#15390davies wants to merge 2 commits into
davies wants to merge 2 commits into
Conversation
davies
commented
Oct 7, 2016
ContributorAuthor
cc @rxin |
| val bits = dt.defaultSize * 8 | ||
| keyExpr = BitwiseOr(ShiftLeft(keyExpr, Literal(bits)), | ||
| BitwiseAnd(Cast(e, LongType), Literal((1L << bits) - 1))) | ||
| width += dt.defaultSize |
Contributor
There was a problem hiding this comment.
This is the only change (for people also reviewing this).
hvanhovell
commented
Oct 7, 2016
Contributor
LGTM pending Jenkins. |
rxin
reviewed
Oct 7, 2016
| * | ||
| * If not, returns the original expressions. | ||
| */ | ||
| private[joins] def rewriteKeyExpr(keys: Seq[Expression]): Seq[Expression] = { |
Contributor
There was a problem hiding this comment.
This will be a lot clear and less error prone if we can write the check first and go through the data twice, e.g.
if (keys.map(_.dataType.defaultSize).sum <= 8) {
return keys
}
// do the rewrite here
SparkQA
commented
Oct 7, 2016
Test build #66510 has finished for PR 15390 at commit
|
rxin
commented
Oct 7, 2016
Contributor
LGTM, pending the new test run. |
SparkQA
commented
Oct 7, 2016
Test build #66522 has finished for PR 15390 at commit
|
asfgit pushed a commit
that referenced
this pull request
Oct 7, 2016
## What changes were proposed in this pull request? In HashJoin, we try to rewrite the join key as Long to improve the performance of finding a match. The rewriting part is not well tested, has a bug that could cause wrong result when there are at least three integral columns in the joining key also the total length of the key exceed 8 bytes. ## How was this patch tested? Added unit test to covering the rewriting with different number of columns and different data types. Manually test the reported case and confirmed that this PR fix the bug. Author: Davies Liu <davies@databricks.com> Closes#15390 from davies/rewrite_key. (cherry picked from commit 94b24b8) Signed-off-by: Davies Liu <davies.liu@gmail.com>
SparkQA
commented
Oct 7, 2016
Test build #3300 has finished for PR 15390 at commit
|
uzadude pushed a commit
to uzadude/spark
that referenced
this pull request
Jan 27, 2017
## What changes were proposed in this pull request? In HashJoin, we try to rewrite the join key as Long to improve the performance of finding a match. The rewriting part is not well tested, has a bug that could cause wrong result when there are at least three integral columns in the joining key also the total length of the key exceed 8 bytes. ## How was this patch tested? Added unit test to covering the rewriting with different number of columns and different data types. Manually test the reported case and confirmed that this PR fix the bug. Author: Davies Liu <davies@databricks.com> Closesapache#15390 from davies/rewrite_key.
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 freeto 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?
In HashJoin, we try to rewrite the join key as Long to improve the performance of finding a match. The rewriting part is not well tested, has a bug that could cause wrong result when there are at least three integral columns in the joining key also the total length of the key exceed 8 bytes.
How was this patch tested?
Added unit test to covering the rewriting with different number of columns and different data types. Manually test the reported case and confirmed that this PR fix the bug.