You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2016/07/17 16:54:20 UTC

[jira] [Created] (SPARK-16594) Physical Plan Differences when Table Scan Having Duplicate Columns

Xiao Li created SPARK-16594:
-------------------------------

             Summary: 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


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 PR is to remove the differences. 




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

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