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

element_at with CreateArray not respect one based index

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.0.2, 3.1.0
    • Component/s: SQL
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: