You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/01 13:20:12 UTC

[GitHub] [spark] gengliangwang commented on a change in pull request #25014: [SPARK-28216][SQL][TEST] Move getDataSize from StatisticsCollectionTestBase to SQLTestUtils

gengliangwang commented on a change in pull request #25014: [SPARK-28216][SQL][TEST] Move getDataSize from StatisticsCollectionTestBase to SQLTestUtils
URL: https://github.com/apache/spark/pull/25014#discussion_r299036113
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala
 ##########
 @@ -424,6 +425,14 @@ private[sql] trait SQLTestUtilsBase
   protected def testFile(fileName: String): String = {
     Thread.currentThread().getContextClassLoader.getResource(fileName).toString
   }
+
+  /**
+   * Returns the size of the local directory except the metadata file and the temporary file.
+   */
+  def getLocalDirSize(file: File): Long = {
+    assert(file.isDirectory)
+    file.listFiles.filter(f => DataSourceUtils.isDataFile(f.getName)).map(_.length).sum
 
 Review comment:
   Nit: we can use `f.toPath` so that we don't need to modify `DataSourceUtils`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org