Skip to content
Snippets Groups Projects
Commit d2dc8c4a authored by Ergin Seyfe's avatar Ergin Seyfe Committed by Reynold Xin
Browse files

[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 <eseyfe@fb.com>

Closes #15337 from seyfe/add_void_object_inspector.
parent b1b47274
No related branches found
No related tags found
No related merge requests found
...@@ -319,6 +319,8 @@ private[hive] trait HiveInspectors { ...@@ -319,6 +319,8 @@ private[hive] trait HiveInspectors {
withNullSafe(o => getTimestampWritable(o)) withNullSafe(o => getTimestampWritable(o))
case _: TimestampObjectInspector => case _: TimestampObjectInspector =>
withNullSafe(o => DateTimeUtils.toJavaTimestamp(o.asInstanceOf[Long])) withNullSafe(o => DateTimeUtils.toJavaTimestamp(o.asInstanceOf[Long]))
case _: VoidObjectInspector =>
(_: Any) => null // always be null for void object inspector
} }
case soi: StandardStructObjectInspector => case soi: StandardStructObjectInspector =>
......
...@@ -81,6 +81,7 @@ class HiveInspectorSuite extends SparkFunSuite with HiveInspectors { ...@@ -81,6 +81,7 @@ class HiveInspectorSuite extends SparkFunSuite with HiveInspectors {
val data = val data =
Literal(true) :: Literal(true) ::
Literal(null) ::
Literal(0.asInstanceOf[Byte]) :: Literal(0.asInstanceOf[Byte]) ::
Literal(0.asInstanceOf[Short]) :: Literal(0.asInstanceOf[Short]) ::
Literal(0) :: Literal(0) ::
......
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