spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #17185: [SPARK-19602][SQL] Support column resolution of f...
Date Tue, 07 Aug 2018 01:31:29 GMT
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: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message