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

Remove unnecessary casts between IntegerType and IntDecimal

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.2.1
    • 3.3.0
    • SQL
    • None

    Description

      In NTile, the number of rows per bucket is computed as n / buckets, where n is the partition size, and buckets is the argument to NTile (number of buckets). The code currently casts the arguments to IntDecimal, then casts the result back to IntegerType. This is unnecessary, since it is equivalent to just doing integer division, i.e. n div buckets.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            David Cashman David Cashman
            David Cashman David Cashman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment