Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22124#discussion_r211183300
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -384,7 +384,12 @@ object RemoveRedundantAliases extends 
Rule[LogicalPlan] {
         }
       }
     
    -  def apply(plan: LogicalPlan): LogicalPlan = removeRedundantAliases(plan, 
AttributeSet.empty)
    +  def apply(plan: LogicalPlan): LogicalPlan = {
    +    plan match {
    +      case c: Command => c
    +      case _ => removeRedundantAliases(plan, AttributeSet.empty)
    --- End diff --
    
    I don't get it. For the query
    ```
    *(1) Project [col1#8L AS COL1#14L, col2#9L AS COL2#15L]
    +- *(1) Filter (isnotnull(col1#8L) && (col1#8L > -20))
       +- *(1) FileScan parquet default.table1[col1#8L,col2#9L] Batched: true, 
Format: Parquet, Location: InMemoryFileIndex[file:/tmp/yumwang/spark/parquet], 
PartitionFilters: [], PushedFilters: [IsNotNull(col1), GreaterThan(col1,-20)], 
ReadSchema: struct<col1:bigint,col2:bigint>
    ```
    
    Why is the alias treated as redundant? The name does change, isn't it?


---

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

Reply via email to