[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:
parent
b385ce3882
commit
9269036d8c
|
@ -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>
|
||||
|
|
|
@ -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))"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue