Skip to content

Commit 068d76f

Browse files
committed
fix review comments
1 parent 06b28e5 commit 068d76f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/hash.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ abstract class HashExpression[E] extends Expression {
247247

248248
override def nullable: Boolean = false
249249

250-
protected def hasMapType(dt: DataType): Boolean = {
250+
private def hasMapType(dt: DataType): Boolean = {
251251
dt.existsRecursively(_.isInstanceOf[MapType])
252252
}
253253

@@ -259,8 +259,8 @@ abstract class HashExpression[E] extends Expression {
259259
!SQLConf.get.getConf(SQLConf.LEGACY_USE_HASH_ON_MAPTYPE)) {
260260
TypeCheckResult.TypeCheckFailure(
261261
s"input to function $prettyName cannot contain elements of MapType. Logically same maps " +
262-
s"may have different hashcode, thus hash expressions are prohibited on MapType " +
263-
s"elements. To restore previous behavior set spark.sql.legacy.useHashOnMapType to true.")
262+
"may have different hashcode, thus hash expressions are prohibited on MapType " +
263+
"elements. To restore previous behavior set spark.sql.legacy.useHashOnMapType to true.")
264264
} else {
265265
TypeCheckResult.TypeCheckSuccess
266266
}

sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,8 +2208,8 @@ object SQLConf {
22082208
val LEGACY_USE_HASH_ON_MAPTYPE = buildConf("spark.sql.legacy.useHashOnMapType")
22092209
.doc("When set to true, hash expressions can be applied on elements of MapType. Otherwise, " +
22102210
"an analysis exception will be thrown.")
2211-
.booleanConf.
2212-
createWithDefault(false)
2211+
.booleanConf
2212+
.createWithDefault(false)
22132213

22142214
/**
22152215
* Holds information about keys that have been deprecated.

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,12 +2134,11 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
21342134
case hashExpression =>
21352135
withSQLConf(SQLConf.LEGACY_USE_HASH_ON_MAPTYPE.key -> true.toString()) {
21362136
val df = spark.createDataset(Map() :: Nil)
2137-
checkAnswer(df.selectExpr("hash(*)"), sql("SELECT hash(map())"))
2137+
checkAnswer(df.selectExpr(s"$hashExpression(*)"), sql(s"SELECT $hashExpression(map())"))
21382138
}
21392139
}
21402140
}
21412141

2142-
21432142
test("xxhash64 function") {
21442143
val df = Seq(1 -> "a", 2 -> "b").toDF("i", "j")
21452144
withTempView("tbl") {

0 commit comments

Comments
 (0)