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

Improve type promotion for input arguments of elementAt function

    XMLWordPrintableJSON

Details

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

    Description

      In ElementAt, when first argument is MapType, we should coerce the key type and the second argument based on findTightestCommonType. This is not happening currently.

      Also, when the first argument is ArrayType, the second argument should be an integer type or a smaller integral type that can be safely casted to an integer type. Currently we may do an unsafe cast.

      spark-sql> select element_at(array(1,2), 1.24);
      
      1
      spark-sql> select element_at(map(1,"one", 2, "two"), 2.2);
      
      two

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: