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

Andrew Or updated SPARK-15722:
------------------------------
    Comment: was deleted

(was: User 'andrewor14' has created a pull request for this issue:
https://github.com/apache/spark/pull/13457)

> Wrong data when CTAS specifies schema
> -------------------------------------
>
>                 Key: SPARK-15722
>                 URL: https://issues.apache.org/jira/browse/SPARK-15722
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Andrew Or
>            Assignee: Andrew Or
>
> {code}
> scala> sql("CREATE TABLE boxes (width INT, length INT, height INT) USING CSV")
> scala> (1 to 3).map { i => (i, i * 2, i * 3) }.toDF("height", "length", 
> "width").write.insertInto("boxes")
> scala> spark.table("boxes").show()
> +-----+------+------+
> |width|length|height|
> +-----+------+------+
> |    1|     2|     3|
> |    2|     4|     6|
> |    3|     6|     9|
> +-----+------+------+
> scala> sql("CREATE TABLE blocks (name STRING, age INT) AS SELECT * FROM 
> boxes")
> scala> spark.table("students").show()
> +----+---+
> |name|age|
> +----+---+
> |   1|  2|
> |   2|  4|
> |   3|  6|
> +----+---+
> {code}
> The columns don't even match in types.



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