Repository: spark
Updated Branches:
  refs/heads/master b1b47274b -> d2dc8c4a1


[SPARK-17773] Input/Output] Add VoidObjectInspector

## What changes were proposed in this pull request?
Added VoidObjectInspector to the list of PrimitiveObjectInspectors

## How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, 
manual tests)
Executing following query was failing.
select SOME_UDAF*(a.arr)
from (
select Array(null) as arr from dim_one_row
) a

After the fix, I am getting the correct output:
res0: Array[org.apache.spark.sql.Row] = Array([null])

Author: Ergin Seyfe <[email protected]>

Closes #15337 from seyfe/add_void_object_inspector.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d2dc8c4a
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d2dc8c4a
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d2dc8c4a

Branch: refs/heads/master
Commit: d2dc8c4a162834818190ffd82894522c524ca3e5
Parents: b1b4727
Author: Ergin Seyfe <[email protected]>
Authored: Mon Oct 3 23:28:39 2016 -0700
Committer: Reynold Xin <[email protected]>
Committed: Mon Oct 3 23:28:39 2016 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala  | 2 ++
 .../test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala  | 1 +
 2 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/d2dc8c4a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala 
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
index c3c4351..fe34caa 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
@@ -319,6 +319,8 @@ private[hive] trait HiveInspectors {
         withNullSafe(o => getTimestampWritable(o))
       case _: TimestampObjectInspector =>
         withNullSafe(o => DateTimeUtils.toJavaTimestamp(o.asInstanceOf[Long]))
+      case _: VoidObjectInspector =>
+        (_: Any) => null // always be null for void object inspector
     }
 
     case soi: StandardStructObjectInspector =>

http://git-wip-us.apache.org/repos/asf/spark/blob/d2dc8c4a/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala
index bc51bcb..3de1f4a 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala
@@ -81,6 +81,7 @@ class HiveInspectorSuite extends SparkFunSuite with 
HiveInspectors {
 
   val data =
     Literal(true) ::
+    Literal(null) ::
     Literal(0.asInstanceOf[Byte]) ::
     Literal(0.asInstanceOf[Short]) ::
     Literal(0) ::


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to