You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2020/12/18 00:40:11 UTC
[spark] branch branch-3.0 updated: Revert "[SPARK-33822][SQL] Use
the `CastSupport.cast` method in HashJoin"
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 5ce0b9f Revert "[SPARK-33822][SQL] Use the `CastSupport.cast` method in HashJoin"
5ce0b9f is described below
commit 5ce0b9fc607a26c6f3b2fa0eec7a5c1f9010ff1f
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Thu Dec 17 16:37:40 2020 -0800
Revert "[SPARK-33822][SQL] Use the `CastSupport.cast` method in HashJoin"
This reverts commit 3ef6827b25e289924ba03d3521ccce7f2adb4d92.
---
.../spark/sql/execution/joins/HashJoin.scala | 13 ++++-----
.../sql/execution/joins/BroadcastJoinSuite.scala | 33 +++++++++-------------
2 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala
index 0447d7f..931a75a 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala
@@ -17,8 +17,7 @@
package org.apache.spark.sql.execution.joins
-import org.apache.spark.sql.catalyst.{InternalRow, SQLConfHelper}
-import org.apache.spark.sql.catalyst.analysis.CastSupport
+import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.BindReferences.bindReferences
import org.apache.spark.sql.catalyst.plans._
@@ -241,7 +240,7 @@ trait HashJoin {
}
}
-object HashJoin extends CastSupport with SQLConfHelper {
+object HashJoin {
/**
* Try to rewrite the key as LongType so we can use getLong(), if they key can fit with a long.
*
@@ -256,14 +255,14 @@ object HashJoin extends CastSupport with SQLConfHelper {
}
var keyExpr: Expression = if (keys.head.dataType != LongType) {
- cast(keys.head, LongType)
+ Cast(keys.head, LongType)
} else {
keys.head
}
keys.tail.foreach { e =>
val bits = e.dataType.defaultSize * 8
keyExpr = BitwiseOr(ShiftLeft(keyExpr, Literal(bits)),
- BitwiseAnd(cast(e, LongType), Literal((1L << bits) - 1)))
+ BitwiseAnd(Cast(e, LongType), Literal((1L << bits) - 1)))
}
keyExpr :: Nil
}
@@ -276,13 +275,13 @@ object HashJoin extends CastSupport with SQLConfHelper {
// jump over keys that have a higher index value than the required key
if (keys.size == 1) {
assert(index == 0)
- cast(BoundReference(0, LongType, nullable = false), keys(index).dataType)
+ Cast(BoundReference(0, LongType, nullable = false), keys(index).dataType)
} else {
val shiftedBits =
keys.slice(index + 1, keys.size).map(_.dataType.defaultSize * 8).sum
val mask = (1L << (keys(index).dataType.defaultSize * 8)) - 1
// build the schema for unpacking the required key
- cast(BitwiseAnd(
+ Cast(BitwiseAnd(
ShiftRightUnsigned(BoundReference(0, LongType, nullable = false), Literal(shiftedBits)),
Literal(mask)), keys(index).dataType)
}
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/joins/BroadcastJoinSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/joins/BroadcastJoinSuite.scala
index ef0a596..335ef25 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/joins/BroadcastJoinSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/joins/BroadcastJoinSuite.scala
@@ -239,40 +239,33 @@ abstract class BroadcastJoinSuiteBase extends QueryTest with SQLTestUtils
assert(HashJoin.rewriteKeyExpr(l :: l :: Nil) === l :: l :: Nil)
assert(HashJoin.rewriteKeyExpr(l :: i :: Nil) === l :: i :: Nil)
- assert(HashJoin.rewriteKeyExpr(i :: Nil) ===
- Cast(i, LongType, Some(conf.sessionLocalTimeZone)) :: Nil)
+ assert(HashJoin.rewriteKeyExpr(i :: Nil) === Cast(i, LongType) :: Nil)
assert(HashJoin.rewriteKeyExpr(i :: l :: Nil) === i :: l :: Nil)
assert(HashJoin.rewriteKeyExpr(i :: i :: Nil) ===
- BitwiseOr(ShiftLeft(Cast(i, LongType, Some(conf.sessionLocalTimeZone)), Literal(32)),
- BitwiseAnd(Cast(i, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 32) - 1))) ::
- Nil)
+ BitwiseOr(ShiftLeft(Cast(i, LongType), Literal(32)),
+ BitwiseAnd(Cast(i, LongType), Literal((1L << 32) - 1))) :: Nil)
assert(HashJoin.rewriteKeyExpr(i :: i :: i :: Nil) === i :: i :: i :: Nil)
- assert(HashJoin.rewriteKeyExpr(s :: Nil) ===
- Cast(s, LongType, Some(conf.sessionLocalTimeZone)) :: Nil)
+ assert(HashJoin.rewriteKeyExpr(s :: Nil) === Cast(s, LongType) :: Nil)
assert(HashJoin.rewriteKeyExpr(s :: l :: Nil) === s :: l :: Nil)
assert(HashJoin.rewriteKeyExpr(s :: s :: Nil) ===
- BitwiseOr(ShiftLeft(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 16) - 1))) ::
- Nil)
+ BitwiseOr(ShiftLeft(Cast(s, LongType), Literal(16)),
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))) :: Nil)
assert(HashJoin.rewriteKeyExpr(s :: s :: s :: Nil) ===
BitwiseOr(ShiftLeft(
- BitwiseOr(ShiftLeft(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 16) - 1))),
+ BitwiseOr(ShiftLeft(Cast(s, LongType), Literal(16)),
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))),
Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 16) - 1))) ::
- Nil)
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))) :: Nil)
assert(HashJoin.rewriteKeyExpr(s :: s :: s :: s :: Nil) ===
BitwiseOr(ShiftLeft(
BitwiseOr(ShiftLeft(
- BitwiseOr(ShiftLeft(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)),
- Literal((1L << 16) - 1))),
+ BitwiseOr(ShiftLeft(Cast(s, LongType), Literal(16)),
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))),
Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 16) - 1))),
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))),
Literal(16)),
- BitwiseAnd(Cast(s, LongType, Some(conf.sessionLocalTimeZone)), Literal((1L << 16) - 1))) ::
- Nil)
+ BitwiseAnd(Cast(s, LongType), Literal((1L << 16) - 1))) :: Nil)
assert(HashJoin.rewriteKeyExpr(s :: s :: s :: s :: s :: Nil) ===
s :: s :: s :: s :: s :: Nil)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org