[ 
https://issues.apache.org/jira/browse/SPARK-16594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Apache Spark reassigned SPARK-16594:
------------------------------------

    Assignee: Apache Spark

> Physical Plan Differences when Table Scan Having Duplicate Columns
> ------------------------------------------------------------------
>
>                 Key: SPARK-16594
>                 URL: https://issues.apache.org/jira/browse/SPARK-16594
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Xiao Li
>            Assignee: Apache Spark
>
> Currently, we keep two implementations for planning scans over data sources. 
> There is one difference between two implementation when deciding whether a 
> `Project` is needed or not. 
> - Data Source Table Scan: 
> https://github.com/apache/spark/blob/b1e5281c5cb429e338c3719c13c0b93078d7312a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala#L322-L395
>   - `SELECT b, b FROM oneToTenPruned`: **_Add `ProjectExec`._**
> - Hive Table Scan and In-memory Table Scan:
> https://github.com/apache/spark/blob/865ec32dd997e63aea01a871d1c7b4947f43c111/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlanner.scala#L71-L99
>  
>   - `SELECT b, b FROM oneToTenPruned`: **_No `ProjectExec` is added._** 
> **Note.** When alias is being used, we will always add `ProjectExec` in all 
> the scan types.
>   - `SELECT b as alias_b, b FROM oneToTenPruned`: **_Add `ProjectExec`._**
> Because selecting the same column twice without adding `alias` is very weird, 
> no clue why the code needs to behave differently here. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to