Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7548#discussion_r35064307
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala
 ---
    @@ -583,6 +547,60 @@ case class Unhex(child: 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 hex representation
    + * and returns the resulting STRING. Negative numbers would be treated as 
two's complement.
    + */
    +case class Hex(child: Expression) extends UnaryExpression with 
ImplicitCastInputTypes {
    +
    +  override def inputTypes: Seq[AbstractDataType] =
    +    Seq(TypeCollection(LongType, BinaryType, StringType))
    +
    +  override def dataType: DataType = StringType
    +
    +  protected override def nullSafeEval(num: Any): Any = child.dataType 
match {
    +    case LongType => Hex.hex(num.asInstanceOf[Long])
    --- End diff --
    
    Ooops, my mistake...


---
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]

Reply via email to