Skip to content
Snippets Groups Projects
Commit 22036aeb authored by Cheng Lian's avatar Cheng Lian Committed by Reynold Xin
Browse files

[BUGFIX][SQL] Should match java.math.BigDecimal when wnrapping Hive output

The `BigDecimal` branch in `unwrap` matches to `scala.math.BigDecimal` rather than `java.math.BigDecimal`.

Author: Cheng Lian <lian.cs.zju@gmail.com>

Closes #1199 from liancheng/javaBigDecimal and squashes the following commits:

e9bb481 [Cheng Lian] Should match java.math.BigDecimal when wnrapping Hive output
parent 8fade897
No related branches found
No related tags found
No related merge requests found
......@@ -84,7 +84,7 @@ private[hive] object HiveFunctionRegistry
case c: Class[_] if c == classOf[hadoopIo.FloatWritable] => FloatType
case c: Class[_] if c == classOf[hadoopIo.BooleanWritable] => BooleanType
case c: Class[_] if c == classOf[hadoopIo.BytesWritable] => BinaryType
// java class
case c: Class[_] if c == classOf[java.lang.String] => StringType
case c: Class[_] if c == classOf[java.sql.Timestamp] => TimestampType
......@@ -98,7 +98,7 @@ private[hive] object HiveFunctionRegistry
case c: Class[_] if c == classOf[java.lang.Byte] => ByteType
case c: Class[_] if c == classOf[java.lang.Float] => FloatType
case c: Class[_] if c == classOf[java.lang.Boolean] => BooleanType
// primitive type
case c: Class[_] if c == java.lang.Short.TYPE => ShortType
case c: Class[_] if c == java.lang.Integer.TYPE => IntegerType
......@@ -107,7 +107,7 @@ private[hive] object HiveFunctionRegistry
case c: Class[_] if c == java.lang.Byte.TYPE => ByteType
case c: Class[_] if c == java.lang.Float.TYPE => FloatType
case c: Class[_] if c == java.lang.Boolean.TYPE => BooleanType
case c: Class[_] if c.isArray => ArrayType(javaClassToDataType(c.getComponentType))
}
}
......@@ -148,7 +148,7 @@ private[hive] trait HiveFunctionFactory {
case p: java.lang.Byte => p
case p: java.lang.Boolean => p
case str: String => str
case p: BigDecimal => p
case p: java.math.BigDecimal => p
case p: Array[Byte] => p
case p: java.sql.Timestamp => p
}
......
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