Skip to content
Snippets Groups Projects
Commit 12dbf98c authored by Liang-Chi Hsieh's avatar Liang-Chi Hsieh Committed by Michael Armbrust
Browse files

[SPARK-5999][SQL] Remove duplicate Literal matching block

Author: Liang-Chi Hsieh <viirya@gmail.com>

Closes #4760 from viirya/dup_literal and squashes the following commits:

06e7516 [Liang-Chi Hsieh] Remove duplicate Literal matching block.
parent e0fdd467
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ object Literal {
case d: Date => Literal(DateUtils.fromJavaDate(d), DateType)
case a: Array[Byte] => Literal(a, BinaryType)
case null => Literal(null, NullType)
case _ =>
throw new RuntimeException("Unsupported literal type " + v.getClass + " " + v)
}
}
......
......@@ -74,25 +74,7 @@ object functions {
case _ => // continue
}
val literalExpr = literal match {
case v: Boolean => Literal(v, BooleanType)
case v: Byte => Literal(v, ByteType)
case v: Short => Literal(v, ShortType)
case v: Int => Literal(v, IntegerType)
case v: Long => Literal(v, LongType)
case v: Float => Literal(v, FloatType)
case v: Double => Literal(v, DoubleType)
case v: String => Literal(v, StringType)
case v: BigDecimal => Literal(Decimal(v), DecimalType.Unlimited)
case v: java.math.BigDecimal => Literal(Decimal(v), DecimalType.Unlimited)
case v: Decimal => Literal(v, DecimalType.Unlimited)
case v: java.sql.Timestamp => Literal(v, TimestampType)
case v: java.sql.Date => Literal(v, DateType)
case v: Array[Byte] => Literal(v, BinaryType)
case null => Literal(null, NullType)
case _ =>
throw new RuntimeException("Unsupported literal type " + literal.getClass + " " + literal)
}
val literalExpr = Literal(literal)
Column(literalExpr)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment