Skip to content

Commit

Permalink
Yin's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dilipbiswal committed Jan 10, 2016
1 parent 7dae8e1 commit 24b32d5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import scala.reflect.ClassTag

import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.io.{Input, Output}
import com.google.common.base.Objects

import org.apache.avro.Schema
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hive.ql.exec.{UDF, Utilities}
import org.apache.hadoop.hive.ql.plan.{FileSinkDesc, TableDesc}
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMacro
import org.apache.hadoop.hive.serde2.ColumnProjectionUtils
import org.apache.hadoop.hive.serde2.avro.{AvroGenericRecordWritable, AvroSerdeUtils}
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector
Expand Down Expand Up @@ -123,9 +126,21 @@ private[hive] object HiveShim {
// for Serialization
def this() = this(null)

override def hashCode(): Int = {
if (instance != null && instance.isInstanceOf[GenericUDFMacro]) {
Objects.hashCode(functionClassName, instance)
} else {
functionClassName.hashCode()
}
}

override def equals(other: Any): Boolean = other match {
case a: HiveFunctionWrapper =>
functionClassName == a.functionClassName
if (a.instance != null && a.instance.isInstanceOf[GenericUDFMacro]) {
functionClassName == a.functionClassName && instance == a.instance
} else {
functionClassName == a.functionClassName
}
case _ => false
}

Expand Down

0 comments on commit 24b32d5

Please sign in to comment.