Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
[NSE-955] Support hex expression (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE authored Jun 14, 2022
1 parent 82e33b7 commit 737bba4
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,22 @@ class ColumnarLength(child: Expression) extends Length(child: Expression)
}
}

class ColumnarHex(child: Expression) extends Hex(child: Expression)
with ColumnarExpression with Logging {

override def supportColumnarCodegen(args: java.lang.Object): Boolean = {
false
}

override def doColumnarCodeGen(args: java.lang.Object): (TreeNode, ArrowType) = {
val (child_node, _): (TreeNode, ArrowType) =
child.asInstanceOf[ColumnarExpression].doColumnarCodeGen(args)
val resultType = new ArrowType.Utf8()
(TreeBuilder.makeFunction("hex", Lists.newArrayList(child_node),
resultType), resultType)
}
}

object ColumnarUnaryOperator {

def create(child: Expression, original: Expression): Expression = original match {
Expand Down Expand Up @@ -1024,6 +1040,8 @@ object ColumnarUnaryOperator {
new ColumnarRand(child)
case len: Length =>
new ColumnarLength(child)
case hex: Hex =>
new ColumnarHex(child)
case other =>
child.dataType match {
case _: DateType => other match {
Expand Down

0 comments on commit 737bba4

Please sign in to comment.