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

count() after dropDuplicates() on emptyDataFrame returns incorrect value

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.2, 2.2.0, 2.3.0
    • Fix Version/s: 2.2.3, 2.3.0
    • Component/s: SQL
    • Labels:

      Description

      here is a minimal Spark Application to reproduce:

      import org.apache.spark.sql.SQLContext
      import org.apache.spark.{SparkConf, SparkContext}
      
      
      object DropDupesApp extends App {
        
        override def main(args: Array[String]): Unit = {
          val conf = new SparkConf()
            .setAppName("test")
            .setMaster("local")
          val sc = new SparkContext(conf)
          val sql = SQLContext.getOrCreate(sc)
          assert(sql.emptyDataFrame.count == 0) // expected
          assert(sql.emptyDataFrame.dropDuplicates.count == 1) // unexpected
        }
        
      }
      

        Attachments

          Activity

            People

            • Assignee:
              fengliu@databricks.com Feng Liu
              Reporter:
              belbis Michael Dreibelbis
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: