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

    https://github.com/apache/spark/pull/16960#discussion_r101782666
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/metric/SQLMetricsSuite.scala
 ---
    @@ -309,4 +314,94 @@ class SQLMetricsSuite extends SparkFunSuite with 
SharedSQLContext {
         assert(metricInfoDeser.metadata === 
Some(AccumulatorContext.SQL_ACCUM_IDENTIFIER))
       }
     
    +  test("range metrics") {
    +    val res1 = InputOutputMetricsHelper.run(
    +      spark.range(30).filter(x => x % 3 == 0).toDF()
    +    )
    +    assert(res1 === (30L, 0L, 30L) :: Nil)
    +
    +    val res2 = InputOutputMetricsHelper.run(
    +      spark.range(150).repartition(4).filter(x => x < 10).toDF()
    +    )
    +    assert(res2 === (150L, 0L, 150L) :: (0L, 150L, 10L) :: Nil)
    +
    +    withTempDir { tempDir =>
    +      val dir = new File(tempDir, "pqS").getCanonicalPath
    +
    +      spark.range(10).write.parquet(dir)
    +      spark.read.parquet(dir).createOrReplaceTempView("pqS")
    +
    +      val res3 = InputOutputMetricsHelper.run(
    +        spark.range(0, 30).repartition(3).crossJoin(sql("select * from 
pqS")).repartition(2).toDF()
    +      )
    +      assert(res3 === (10L, 0L, 10L) :: (30L, 0L, 30L) :: (0L, 30L, 300L) 
:: (0L, 300L, 0L) :: Nil)
    +    }
    +  }
    +}
    +
    +object InputOutputMetricsHelper {
    +   private class InputOutputMetricsListener extends SparkListener {
    +    private case class MetricsResult(
    --- End diff --
    
    Nit: add space


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to