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 2018/08/06 11:36:00 UTC

[jira] [Commented] (SPARK-25031) The schema of MapType can not be printed correctly

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

Apache Spark commented on SPARK-25031:
--------------------------------------

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

> The schema of MapType can not be printed correctly
> --------------------------------------------------
>
>                 Key: SPARK-25031
>                 URL: https://issues.apache.org/jira/browse/SPARK-25031
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.3.1
>            Reporter: Hao Ren
>            Priority: Minor
>              Labels: easyfix
>
> Something wrong with the function `buildFormattedString` in `MapType`
>  
> {code:java}
> import spark.implicits._
> case class Key(a: Int)
> case class Value(b: Int)
> Seq(
>   (1, Map(Key(1) -> Value(2))), 
>   (2, Map(Key(1) -> Value(2)))
> ).toDF("id", "dict").printSchema
> {code}
> The result is:
> {code:java}
> root
> |-- id: integer (nullable = false)
> |-- dict: map (nullable = true)
> | |-- key: struct
> | |-- value: struct (valueContainsNull = true)
> | | |-- a: integer (nullable = false)
> | | |-- b: integer (nullable = false)
> {code}
>  The expected is
> {code:java}
> root
> |-- id: integer (nullable = false)
> |-- dict: map (nullable = true)
> | |-- key: struct
> | | |-- a: integer (nullable = false)
> | |-- value: struct (valueContainsNull = true)
> | | |-- b: integer (nullable = false)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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