Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class Analyzer(
expr.transformUp { case u @ UnresolvedAlias(child, optGenAliasFunc) =>
child match {
case ne: NamedExpression => ne
case go @ GeneratorOuter(g: Generator) if g.resolved => MultiAlias(go, Nil)
case e if !e.resolved => u
case g: Generator => MultiAlias(g, Nil)
case c @ Cast(ne: NamedExpression, _, _) => Alias(c, ne.name)()
Expand Down Expand Up @@ -1665,7 +1666,6 @@ class Analyzer(
var resolvedGenerator: Generate = null

val newProjectList = projectList.flatMap {

case AliasedGenerator(generator, names, outer) if generator.childrenResolved =>
// It's a sanity check, this should not happen as the previous case will throw
// exception earlier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ case class Stack(children: Seq[Expression]) extends Generator {
}
}


/**
* Only support code generation when stack produces 50 rows or less.
*/
Expand Down Expand Up @@ -204,6 +203,10 @@ case class Stack(children: Seq[Expression]) extends Generator {
}
}

/**
* Wrapper around another generator to specify outer behavior. This is used to implement functions
* such as explode_outer. This expression gets replaced during analysis.
*/
case class GeneratorOuter(child: Generator) extends UnaryExpression with Generator {
final override def eval(input: InternalRow = null): TraversableOnce[InternalRow] =
throw new UnsupportedOperationException(s"Cannot evaluate expression: $this")
Expand All @@ -212,7 +215,10 @@ case class GeneratorOuter(child: Generator) extends UnaryExpression with Generat
throw new UnsupportedOperationException(s"Cannot evaluate expression: $this")

override def elementSchema: StructType = child.elementSchema

override lazy val resolved: Boolean = false
}

/**
* A base class for [[Explode]] and [[PosExplode]].
*/
Expand Down