You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2017/06/24 03:28:02 UTC

[jira] [Created] (SPARK-21203) Wrong result are inserted by Array of Struct

Xiao Li created SPARK-21203:
-------------------------------

             Summary: Wrong result are inserted by Array of Struct
                 Key: SPARK-21203
                 URL: https://issues.apache.org/jira/browse/SPARK-21203
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.1.1, 2.2.0
            Reporter: Xiao Li
            Assignee: Xiao Li
            Priority: Critical


{noformat}
      spark.sql(
        """
          |CREATE TABLE `tab1`
          |(`custom_fields` ARRAY<STRUCT<`id`: BIGINT, `value`: STRING>>)
          |USING parquet
        """.stripMargin)
      spark.sql(
        """
          |INSERT INTO `tab1`
          |SELECT ARRAY(named_struct('id', 1, 'value', 'a'), named_struct('id', 2, 'value', 'b'))
        """.stripMargin)

      spark.sql("SELECT custom_fields.id, custom_fields.value FROM tab1").show()
{noformat}

The returned result is wrong:
{noformat}
Row(Array(2, 2), Array("b", "b"))
{noformat}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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