Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark-2137][SQL] Timestamp UDFs broken #1081

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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 @@ -250,7 +250,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {

protected val primitiveTypes =
Seq(StringType, IntegerType, LongType, DoubleType, FloatType, BooleanType, ByteType,
ShortType, DecimalType)
ShortType, DecimalType, TimestampType)

protected def toHiveString(a: (Any, DataType)): String = a match {
case (struct: Row, StructType(fields)) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ private[hive] case class HiveSimpleUdf(name: String, children: Seq[Expression])
val primitiveClasses = Seq(
Integer.TYPE, classOf[java.lang.Integer], classOf[java.lang.String], java.lang.Double.TYPE,
classOf[java.lang.Double], java.lang.Long.TYPE, classOf[java.lang.Long],
classOf[HiveDecimal], java.lang.Byte.TYPE, classOf[java.lang.Byte]
classOf[HiveDecimal], java.lang.Byte.TYPE, classOf[java.lang.Byte],
classOf[java.sql.Timestamp]
)
val matchingConstructor = argClass.getConstructors.find { c =>
c.getParameterTypes.size == 1 && primitiveClasses.contains(c.getParameterTypes.head)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 07:08:09.1234567 2011-05-06 02:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 07:08:09.1234567 2011-05-06 02:08:09.1234567 2011-05-06 07:08:09.1234567 2011-05-06 02:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 07:08:09.1234567 2011-05-06 12:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 07:08:09.1234567 2011-05-06 12:08:09.1234567 2011-05-06 07:08:09.1234567 2011-05-06 12:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1304690889 2011 5 6 6 18 7 8 9 2011-05-06
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-11 2011-04-26
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 3333 -3333
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 02:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 12:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1304690889 2011 5 6 6 18 7 8 9 2011-05-06
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-11 2011-04-26
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 3333 -3333
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 02:08:09.1234567
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2011-05-06 12:08:09.1234567