You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/12/27 00:07:58 UTC

[jira] [Commented] (SPARK-19005) Keep column ordering when a schema is explicitly specified

    [ https://issues.apache.org/jira/browse/SPARK-19005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15779235#comment-15779235 ] 

Apache Spark commented on SPARK-19005:
--------------------------------------

User 'maropu' has created a pull request for this issue:
https://github.com/apache/spark/pull/16410

>  Keep column ordering when a schema is explicitly specified
> -----------------------------------------------------------
>
>                 Key: SPARK-19005
>                 URL: https://issues.apache.org/jira/browse/SPARK-19005
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.1.0
>            Reporter: Takeshi Yamamuro
>            Priority: Minor
>
> This ticket is to keep column ordering when a schema is explicitly specified.
> A concrete example is as follows;
> {code}
> scala> import org.apache.spark.sql.types._
> scala> case class A(a: Long, b: Int)
> scala> val as = Seq(A(1, 2))
> scala> spark.createDataFrame(as).write.parquet("/Users/maropu/Desktop/data/a=1/")
> scala> val df = spark.read.parquet("/Users/maropu/Desktop/data/")
> scala> df.printSchema
> root
>  |-- a: integer (nullable = true)
>  |-- b: integer (nullable = true)
> scala> val schema = new StructType().add("a", LongType).add("b", IntegerType)
> scala> val df = spark.read.schema(schema).parquet("/Users/maropu/Desktop/data/")
> scala> df.printSchema
> root
>  |-- b: integer (nullable = true)
>  |-- a: long (nullable = true)
> {code}



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