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

[NSE-955] Support hex expression #971

Merged
merged 3 commits into from
Jun 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,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 @@ -992,6 +1008,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