aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst
diff options
context:
space:
mode:
authorTakuya UESHIN <ueshin@happy-camper.st>2014-08-11 20:18:03 -0700
committerMichael Armbrust <michael@databricks.com>2014-08-11 20:18:03 -0700
commitc686b7dd4668b5e9fc3177f15edeae3446d2e634 (patch)
treead4b4fe5da309527db8c704cf33126eeae24f6a6 /sql/catalyst
parentc9c89c31b6114832fe282c21fecd663d8105b9bc (diff)
downloadspark-c686b7dd4668b5e9fc3177f15edeae3446d2e634.tar.gz
spark-c686b7dd4668b5e9fc3177f15edeae3446d2e634.tar.bz2
spark-c686b7dd4668b5e9fc3177f15edeae3446d2e634.zip
[SPARK-2968][SQL] Fix nullabilities of Explode.
Output nullabilities of `Explode` could be detemined by `ArrayType.containsNull` or `MapType.valueContainsNull`. Author: Takuya UESHIN <ueshin@happy-camper.st> Closes #1888 from ueshin/issues/SPARK-2968 and squashes the following commits: d128c95 [Takuya UESHIN] Fix nullability of Explode.
Diffstat (limited to 'sql/catalyst')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala
index 3d41acb79e..e99c5b452d 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala
@@ -86,19 +86,19 @@ case class Explode(attributeNames: Seq[String], child: Expression)
(child.dataType.isInstanceOf[ArrayType] || child.dataType.isInstanceOf[MapType])
private lazy val elementTypes = child.dataType match {
- case ArrayType(et, _) => et :: Nil
- case MapType(kt,vt, _) => kt :: vt :: Nil
+ case ArrayType(et, containsNull) => (et, containsNull) :: Nil
+ case MapType(kt, vt, valueContainsNull) => (kt, false) :: (vt, valueContainsNull) :: Nil
}
// TODO: Move this pattern into Generator.
protected def makeOutput() =
if (attributeNames.size == elementTypes.size) {
attributeNames.zip(elementTypes).map {
- case (n, t) => AttributeReference(n, t, nullable = true)()
+ case (n, (t, nullable)) => AttributeReference(n, t, nullable)()
}
} else {
elementTypes.zipWithIndex.map {
- case (t, i) => AttributeReference(s"c_$i", t, nullable = true)()
+ case ((t, nullable), i) => AttributeReference(s"c_$i", t, nullable)()
}
}