Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21909#discussion_r206400571
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala
 ---
    @@ -119,8 +119,47 @@ object CSVBenchmarks {
         }
       }
     
    +  def countBenchmark(rowsNum: Int): Unit = {
    +    val colsNum = 10
    +    val benchmark = new Benchmark(s"Count a dataset with $colsNum 
columns", rowsNum)
    +
    +    withTempPath { path =>
    +      val fields = Seq.tabulate(colsNum)(i => StructField(s"col$i", 
IntegerType))
    +      val schema = StructType(fields)
    +
    +      spark.range(rowsNum)
    +        .select(Seq.tabulate(colsNum)(i => lit(i).as(s"col$i")): _*)
    +        .write
    +        .csv(path.getAbsolutePath)
    +
    +      val ds = spark.read.schema(schema).csv(path.getAbsolutePath)
    +
    +      benchmark.addCase(s"Select $colsNum columns + count()", 3) { _ =>
    +        ds.select("*").filter((_: Row) => true).count()
    +      }
    +      benchmark.addCase(s"Select 1 column + count()", 3) { _ =>
    +        ds.select($"col1").filter((_: Row) => true).count()
    --- End diff --
    
    does this benchmark result vary if we select `col2` or `col10`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to