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

Provide isEmpty() function in DataSet

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

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.4.0
    • Component/s: Spark Core, SQL
    • Labels:
      None

      Description

      Like rdd.isEmpty, adding isEmpty to DataSet would useful. 

      Some code without isEmpty:

      if (df.count = 0) { do_something }

       Some people add limit 1 for a performance reason:

      if (df.limit(1).rdd.isEmpty) { do_something }
      if (df.rdd.take(1).isEmpty) { do_something }

       

      If isEmpty is provided, the code will be perfect clean:

      if (df.isEmpty)  { do_something }

       

       

       

       

       

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              gounna@gmail.com Goun Na
              Reporter:
              gounna@gmail.com Goun Na

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment