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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to