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

conv() inconsistently handles invalid strings with > 64 invalid characters

    XMLWordPrintableJSON

Details

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

    Description

      1/ SPARK-33428 fixed ArrayIndexOutofBoundsException but introduced a new inconsistency in behaviour where the returned value is different above the 64 char threshold.

       

      scala> spark.sql("select conv(repeat('?', 64), 10, 16)").show
      +---------------------------+
      |conv(repeat(?, 64), 10, 16)|
      +---------------------------+
      |                          0|
      +---------------------------+
      
      
      
      
      scala> spark.sql("select conv(repeat('?', 65), 10, 16)").show
      +---------------------------+
      |conv(repeat(?, 65), 10, 16)|
      +---------------------------+
      |           FFFFFFFFFFFFFFFF|
      +---------------------------+
      
      
      
      
      scala> spark.sql("select conv(repeat('?', 65), 10, -16)").show
      +----------------------------+
      |conv(repeat(?, 65), 10, -16)|
      +----------------------------+
      |                          -1|
      +----------------------------+
      
      
      
      
      scala> spark.sql("select conv(repeat('?', 64), 10, -16)").show
      +----------------------------+
      |conv(repeat(?, 64), 10, -16)|
      +----------------------------+
      |                           0|
      +----------------------------+

       

      2/ conv should return result equal to max unsigned long value in base toBase when there is overflow

      scala> spark.sql(select conv('aaaaaaa0aaaaaaa0a', 16, 10)).show 
      // which should be 18446744073709551615
      
      +-------------------------------+
      |conv(aaaaaaa0aaaaaaa0a, 16, 10)|
      +-------------------------------+
      |           12297828695278266890|
      +-------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              dc-heros dgd_contributor
              tarmstrong Tim Armstrong
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: