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

[NSE-955] implement lower function #968

Merged
merged 9 commits into from
Jun 14, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,32 @@ class ColumnarUpper(child: Expression, original: Expression)
}
}

class ColumnarLower(child: Expression, original: Expression)
extends Upper(child: Expression)
LizZhang315 marked this conversation as resolved.
Show resolved Hide resolved
with ColumnarExpression
with Logging {

buildCheck()

def buildCheck(): Unit = {
val supportedTypes = List(StringType)
if (supportedTypes.indexOf(child.dataType) == -1) {
throw new UnsupportedOperationException(
s"${child.dataType} is not supported in ColumnarLower")
}
}

override def doColumnarCodeGen(args: java.lang.Object): (TreeNode, ArrowType) = {
val (child_node, childType): (TreeNode, ArrowType) =
child.asInstanceOf[ColumnarExpression].doColumnarCodeGen(args)

val resultType = new ArrowType.Utf8()
val funcNode =
TreeBuilder.makeFunction("lower", Lists.newArrayList(child_node), resultType)
(funcNode, resultType)
}
}

class ColumnarBitwiseNot(child: Expression, original: Expression)
extends BitwiseNot(child: Expression)
with ColumnarExpression
Expand Down Expand Up @@ -958,6 +984,8 @@ object ColumnarUnaryOperator {
new ColumnarCeil(child, c)
case u: Upper =>
new ColumnarUpper(child, u)
case l: Lower =>
new ColumnarLower(child, l)
case c: Cast =>
new ColumnarCast(child, c.dataType, c.timeZoneId, c)
case u: UnscaledValue =>
Expand Down