Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-33391

element_at with CreateArray not respect one based index

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.0.2, 3.1.0
    • SQL
    • None

    Description

      var df = spark.sql("select element_at(array(3, 2, 1), 0)")
      df.printSchema()

      df = spark.sql("select element_at(array(3, 2, 1), 1)")
      df.printSchema()

      df = spark.sql("select element_at(array(3, 2, 1), 2)")
      df.printSchema()

      df = spark.sql("select element_at(array(3, 2, 1), 3)")
      df.printSchema()

      root

      – element_at(array(3, 2, 1), 0): integer (nullable = false)

      root

      – element_at(array(3, 2, 1), 1): integer (nullable = false)

      root

      – element_at(array(3, 2, 1), 2): integer (nullable = false)

      root

      – element_at(array(3, 2, 1), 3): integer (nullable = true)

       

      In this case, the nullable property in element_at with CreateArray statement is not correct.

       

      Attachments

        Activity

          People

            leanken Leanken.Lin
            leanken Leanken.Lin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: