Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/6976#discussion_r33420126
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala
---
@@ -287,6 +286,88 @@ case class Pow(left: Expression, right: Expression)
}
}
+/**
+ * If the argument is an INT or binary, hex returns the number as a STRING
in hexadecimal format.
+ * Otherwise if the number is a STRING,
+ * it converts each character into its hexadecimal representation and
returns the resulting STRING.
+ * Negative numbers would be treated as two's complement.
+ */
+case class Hex(child: Expression)
+ extends UnaryExpression with Serializable {
+
+ override def dataType: DataType = StringType
+
+ override def checkInputDataTypes(): TypeCheckResult = {
+ if (child.dataType.isInstanceOf[StringType]
+ || child.dataType.isInstanceOf[IntegerType]
+ || child.dataType.isInstanceOf[LongType]
+ || child .dataType.isInstanceOf[BinaryType]
--- End diff --
`child.dataType`, remove the space.
---
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]