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

Provide isEmpty() function in DataSet

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.1.0
    • 2.4.0
    • Spark Core, SQL
    • 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

            gounna@gmail.com Goun Na
            gounna@gmail.com Goun Na
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: