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

[NSE-581] adding ShortType/FloatType in ColumnarLiteral #939

Merged
merged 4 commits into from
May 31, 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 @@ -42,7 +42,7 @@ class ColumnarLiteral(lit: Literal)

def buildCheck(): ArrowType = {
val supportedTypes =
List(StringType, IntegerType, LongType, DoubleType, DateType,
List(StringType, IntegerType, LongType, DoubleType, FloatType, DateType,
BooleanType, CalendarIntervalType, BinaryType, TimestampType)
if (supportedTypes.indexOf(dataType) == -1 && !dataType.isInstanceOf[DecimalType]) {
// Decimal is supported in ColumnarLiteral
Expand Down Expand Up @@ -97,6 +97,13 @@ class ColumnarLiteral(lit: Literal)
case _ =>
(TreeBuilder.makeLiteral(value.asInstanceOf[Integer]), resultType)
}
case t: ShortType =>
value match {
case null =>
(TreeBuilder.makeNull(resultType), resultType)
case _ =>
(TreeBuilder.makeLiteral(value.asInstanceOf[Integer]), resultType)
}
case t: LongType =>
value match {
case null =>
Expand All @@ -111,6 +118,13 @@ class ColumnarLiteral(lit: Literal)
case _ =>
(TreeBuilder.makeLiteral(value.asInstanceOf[java.lang.Double]), resultType)
}
case t: FloatType =>
value match {
case null =>
(TreeBuilder.makeNull(resultType), resultType)
case _ =>
(TreeBuilder.makeLiteral(value.asInstanceOf[java.lang.Float]), resultType)
}
case d: DecimalType =>
value match {
case null =>
Expand Down