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/28 00:41:04 UTC

[GitHub] [spark] maropu commented on a change in pull request #22502: [SPARK-25474][SQL] When the "fallBackToHdfsForStats= true", Size in bytes is coming as default size in bytes ( 8.0 EB)

maropu commented on a change in pull request #22502: [SPARK-25474][SQL] When the "fallBackToHdfsForStats= true", Size in bytes is coming as default size in bytes ( 8.0 EB)
URL: https://github.com/apache/spark/pull/22502#discussion_r307981598
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/CommandUtils.scala
 ##########
 @@ -344,4 +345,16 @@ object CommandUtils extends Logging {
   private def isDataPath(path: Path, stagingDir: String): Boolean = {
     !path.getName.startsWith(stagingDir) && DataSourceUtils.isDataPath(path)
   }
+
+  def getSizeInBytesFallBackToHdfs(session: SparkSession, path: Path, defaultSize: Long): Long = {
+    try {
+      val hadoopConf = session.sessionState.newHadoopConf()
+      val fs: FileSystem = path.getFileSystem(hadoopConf)
+      fs.getContentSummary(path).getLength
+    } catch {
+      case e: IOException =>
 
 Review comment:
   rather,  `case NonFatal(e) =>`?
   

----------------------------------------------------------------
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