cloud-fan commented on a change in pull request #32017:
URL: https://github.com/apache/spark/pull/32017#discussion_r606954761



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -924,11 +947,6 @@ case class SubqueryAlias(
     child.output.map(_.withQualifier(qualifierList))
   }
 
-  override def metadataOutput: Seq[Attribute] = {
-    val qualifierList = identifier.qualifier :+ alias
-    child.metadataOutput.map(_.withQualifier(qualifierList))
-  }

Review comment:
       I think we should only expose the metadata column in a single SELECT 
group, e.g. `SELECT _file FROM t`, `SELECT t1._file FROM t1 JOIN t2`.
   
   It's super weird if we can propagate the metadata column through SELECT 
groups, e.g. `SELECT s._file FROM (SELECT a, b FROM t) s`. The `s` is a 
subquery alias and the subquery has a clear output list which is `a, b`. It may 
surprise users if they can access `s._file`.
   
   However, I do agree with @rdblue that simple alias should be supported. For 
example, `SELECT t1._file FROM t t1 JOIN t t2`. `SELECT s._file FROM (SELECT 
...) s` won't work anyway because `Project` can't propagate the metadata 
columns.
   
   That said, let's propagate metadata columns in `SubqueryAlias`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to