[SPARK-11565] Replace deprecated DigestUtils.shaHex call

Author: Gábor Lipták <gliptak@gmail.com>

Closes #9532 from gliptak/SPARK-11565.
This commit is contained in:
Gábor Lipták 2016-02-10 09:52:35 +00:00 committed by Sean Owen
parent b385ce3882
commit 9269036d8c
2 changed files with 6 additions and 2 deletions

View file

@ -75,6 +75,10 @@
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
</dependencies>
<build>
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>

View file

@ -143,11 +143,11 @@ case class Sha1(child: Expression) extends UnaryExpression with ImplicitCastInpu
override def inputTypes: Seq[DataType] = Seq(BinaryType)
protected override def nullSafeEval(input: Any): Any =
UTF8String.fromString(DigestUtils.shaHex(input.asInstanceOf[Array[Byte]]))
UTF8String.fromString(DigestUtils.sha1Hex(input.asInstanceOf[Array[Byte]]))
override def genCode(ctx: CodegenContext, ev: ExprCode): String = {
defineCodeGen(ctx, ev, c =>
s"UTF8String.fromString(org.apache.commons.codec.digest.DigestUtils.shaHex($c))"
s"UTF8String.fromString(org.apache.commons.codec.digest.DigestUtils.sha1Hex($c))"
)
}
}