wangyum commented on a change in pull request #24551: [SPARK-27655][SQL] 
Persistent the table statistics to metadata after fall back to hdfs
URL: https://github.com/apache/spark/pull/24551#discussion_r281920773
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala
 ##########
 @@ -117,19 +118,29 @@ class DetermineTableStats(session: SparkSession) extends 
Rule[LogicalPlan] {
     case relation: HiveTableRelation
         if DDLUtils.isHiveTable(relation.tableMeta) && 
relation.tableMeta.stats.isEmpty =>
       val table = relation.tableMeta
-      val sizeInBytes = if 
(session.sessionState.conf.fallBackToHdfsForStatsEnabled) {
+      val sessionState = session.sessionState
+      val sizeInBytes = if (sessionState.conf.fallBackToHdfsForStatsEnabled) {
         try {
-          val hadoopConf = session.sessionState.newHadoopConf()
+          val hadoopConf = sessionState.newHadoopConf()
           val tablePath = new Path(table.location)
           val fs: FileSystem = tablePath.getFileSystem(hadoopConf)
-          fs.getContentSummary(tablePath).getLength
+          val newSize = fs.getContentSummary(tablePath).getLength
+
+          if (sessionState.conf.persistentStatsAfterFallBackEnabled) {
+            val threadName = s"update-${table.identifier.unquotedString}-stats"
+            ThreadUtils.runInNewThread(threadName, isJoin = false) {
 
 Review comment:
   Set `isJoin = false`: Do not wait for this thread to die.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to