Repository: spark Updated Branches: refs/heads/branch-2.0 a9165bb1b -> a4f7df423
[SPARK-17773][BRANCH-2.0] Input/Output] Add VoidObjectInspector This is the PR for branch2.0: PR https://github.com/apache/spark/pull/15337 Added VoidObjectInspector to the list of PrimitiveObjectInspectors (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 <eseyfefb.com> Closes #15337 from seyfe/add_void_object_inspector. Author: Ergin Seyfe <[email protected]> Closes #15345 from seyfe/add_void_object_inspector_2.0. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/a4f7df42 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/a4f7df42 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/a4f7df42 Branch: refs/heads/branch-2.0 Commit: a4f7df423e1e0aa512dfc496bc9de13831eae3f3 Parents: a9165bb Author: Ergin Seyfe <[email protected]> Authored: Tue Oct 4 12:39:01 2016 -0700 Committer: Herman van Hovell <[email protected]> Committed: Tue Oct 4 12:39:01 2016 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala | 3 +++ .../test/scala/org/apache/spark/sql/hive/HiveInspectorSuite.scala | 1 + 2 files changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/a4f7df42/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 9d56aec..ce6c533 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 @@ -424,6 +424,9 @@ private[hive] trait HiveInspectors { null } + case _: VoidObjectInspector => + (_: Any) => null // always be null for void object inspector + case soi: StandardStructObjectInspector => val schema = dataType.asInstanceOf[StructType] val wrappers = soi.getAllStructFieldRefs.asScala.zip(schema.fields).map { http://git-wip-us.apache.org/repos/asf/spark/blob/a4f7df42/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 3b867bb..5fda367 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 @@ -75,6 +75,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]
