Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19878#discussion_r154683889
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/hash.scala
---
@@ -730,23 +776,29 @@ case class HiveHash(children: Seq[Expression])
extends HashExpression[Int] {
input: String,
result: String,
fields: Array[StructField]): String = {
- val localResult = ctx.freshName("localResult")
val childResult = ctx.freshName("childResult")
- fields.zipWithIndex.map { case (field, index) =>
+ val fieldsHash = fields.zipWithIndex.map { case (field, index) =>
+ val computeFieldHash = nullSafeElementHash(
+ input, index.toString, field.nullable, field.dataType,
childResult, ctx)
s"""
- $childResult = 0;
- ${nullSafeElementHash(input, index.toString, field.nullable,
field.dataType,
- childResult, ctx)}
- $localResult = (31 * $localResult) + $childResult;
- """
- }.mkString(
--- End diff --
We forgot to split the code for computing hive hash of struct, it's fixed
now.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]