You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Rekha Joshi (JIRA)" <ji...@apache.org> on 2016/06/19 02:14:05 UTC

[jira] [Updated] (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 ]

Rekha Joshi updated SPARK-15722:
--------------------------------
    Description: 
{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("boxes").show()
+----+---+
|name|age|
+----+---+
|   1|  2|
|   2|  4|
|   3|  6|
+----+---+
{code}
The columns don't even match in types.

  was:
{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.


> 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("boxes").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