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

ArrayPosition function may return incorrect result when right expression is implicitly downcasted.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 2.4.0
    • SQL
    • None

    Description

      In ArrayPosition, we currently cast the right hand side expression to match the element type of the left hand side Array. This may result in down casting and may return wrong result or questionable result.

      Example :
      spark-sql> select array_position(array(1), 1.34);
      1

      spark-sql> select array_position(array(1), 'foo');
      null

      We should safely coerce both left and right hand side expressions.

      Attachments

        Issue Links

          Activity

            People

              dkbiswal Dilip Biswal
              dkbiswal Dilip Biswal
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: