Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6934#discussion_r33058823
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
---
@@ -44,7 +47,96 @@ case class Md5(child: Expression)
override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode):
String = {
defineCodeGen(ctx, ev, c =>
- "org.apache.spark.unsafe.types.UTF8String.fromString" +
- s"(org.apache.commons.codec.digest.DigestUtils.md5Hex($c))")
+
s"${ctx.stringType}.fromString(org.apache.commons.codec.digest.DigestUtils.md5Hex($c))")
+ }
+}
+
+/**
+ * A function that calculates the SHA-2 family of functions (SHA-224,
SHA-256, SHA-384, and SHA-512)
+ * and returns it as a hex string. The first argument is the string or
binary to be hashed. The
+ * second argument indicates the desired bit length of the result, which
must have a value of 224,
+ * 256, 384, 512, or 0 (which is equivalent to 256). SHA-224 is supported
starting from Java 8. If
+ * asking for an unsupported SHA function, the return value is NULL. If
either argument is NULL or
+ * the hash length is not one of the permitted values, the return value is
NULL.
+ */
+case class Sha2(left: Expression, right: Expression)
+ extends BinaryExpression with Serializable with ExpectsInputTypes {
self: Product =>
--- End diff --
remove `self: Product =>`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]