Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/17185#discussion_r208074858
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
---
@@ -794,19 +795,37 @@ case class LocalLimit(limitExpr: Expression, child:
LogicalPlan) extends OrderPr
/**
* Aliased subquery.
*
- * @param alias the alias name for this subquery.
+ * @param name the alias identifier for this subquery.
* @param child the logical plan of this subquery.
*/
case class SubqueryAlias(
- alias: String,
+ name: AliasIdentifier,
child: LogicalPlan)
extends OrderPreservingUnaryNode {
- override def doCanonicalize(): LogicalPlan = child.canonicalized
+ def alias: String = name.identifier
- override def output: Seq[Attribute] =
child.output.map(_.withQualifier(Some(alias)))
+ override def output: Seq[Attribute] = {
+ val qualifierList = name.database.map(Seq(_,
alias)).getOrElse(Seq(alias))
+ child.output.map(_.withQualifier(qualifierList))
+ }
+ override def doCanonicalize(): LogicalPlan = child.canonicalized
}
+object SubqueryAlias {
+ def apply(
+ identifier: String,
+ child: LogicalPlan): SubqueryAlias = {
+ SubqueryAlias(AliasIdentifier(identifier), child)
+ }
+
+ def apply(
+ identifier: String,
+ database: Option[String],
--- End diff --
why it's `Option`? if no database name, we should call the `apply` method
above
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]