[ https://issues.apache.org/jira/browse/SPARK-36229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17384666#comment-17384666 ]
dgd_contributor edited comment on SPARK-36229 at 7/21/21, 5:44 AM: ------------------------------------------------------------------- After look closely, I found out that the overflow check in encode is wrong and need to work on too. For example: {code:java} scala> spark.sql(select conv('aaaaaaa0aaaaaaa0a', 16, 10)).show +-------------------------------+ |conv(aaaaaaa0aaaaaaa0a, 16, 10)| +-------------------------------+ | 12297828695278266890| +-------------------------------+{code} which should be 18446744073709551615 I will raise a pull request soon was (Author: dc-heros): After look closely, I found out that the overflow check in encode is wrong and need to work on too. For example: {code:java} scala> spark.sql(select conv('aaaaaaa0aaaaaaa0a', 16, 10)).show +-------------------------------+ |conv(aaaaaaa0aaaaaaa0a, 16, 10)| +-------------------------------+ | 12297828695278266890| +-------------------------------+ which should be 18446744073709551615{code} I will raise a pull request soon > conv() inconsistently handles invalid strings with > 64 invalid characters > -------------------------------------------------------------------------- > > Key: SPARK-36229 > URL: https://issues.apache.org/jira/browse/SPARK-36229 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 3.2.0 > Reporter: Tim Armstrong > Priority: Major > > SPARK-33428 fixed ArrayIndexOutofBoundsException but introduced a new > inconsistency in behaviour where the returned value is different above the 64 > char threshold. > > {noformat} > 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| > +----------------------------+{noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org