Skip to content

Commit 09532ec

Browse files
committed
Fix Generate output nullabilities.
1 parent f20f196 commit 09532ec

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,21 @@ case class Generate(
4646
child: LogicalPlan)
4747
extends UnaryNode {
4848

49-
protected def generatorOutput: Seq[Attribute] =
50-
alias
49+
protected def generatorOutput: Seq[Attribute] = {
50+
val output = alias
5151
.map(a => generator.output.map(_.withQualifiers(a :: Nil)))
5252
.getOrElse(generator.output)
53+
if (outer) {
54+
output.map {
55+
case attr if !attr.nullable =>
56+
AttributeReference(
57+
attr.name, attr.dataType, nullable = true)(attr.exprId, attr.qualifiers)
58+
case attr => attr
59+
}
60+
} else {
61+
output
62+
}
63+
}
5364

5465
override def output =
5566
if (join) child.output ++ generatorOutput else generatorOutput

0 commit comments

Comments
 (0)