You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (JIRA)" <ji...@apache.org> on 2016/06/03 21:40:59 UTC

[jira] [Resolved] (SPARK-15722) Wrong data when CTAS specifies schema

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

Wenchen Fan resolved SPARK-15722.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.0.0

Issue resolved by pull request 13490
[https://github.com/apache/spark/pull/13490]

> 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
>             Fix For: 2.0.0
>
>
> {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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org