Skip to content

Commit

Permalink
[SPARK-11565] Replace deprecated DigestUtils.shaHex call
Browse files Browse the repository at this point in the history
Author: Gábor Lipták <[email protected]>

Closes apache#9532 from gliptak/SPARK-11565.
  • Loading branch information
gliptak authored and srowen committed Feb 10, 2016
1 parent b385ce3 commit 9269036
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sql/catalyst/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
)
}
}
Expand Down

0 comments on commit 9269036

Please sign in to comment.