vikramahuja1001 commented on a change in pull request #3565: [CARBONDATA-3662]: 
Changes to show metacache command
URL: https://github.com/apache/carbondata/pull/3565#discussion_r365180130
 
 

 ##########
 File path: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/cache/CarbonShowCacheCommand.scala
 ##########
 @@ -110,13 +137,42 @@ case class CarbonShowCacheCommand(tableIdentifier: 
Option[TableIdentifier],
     }
   }
 
+  def getAllExecutorCache(sparkSession: SparkSession): Seq[Row] = {
+    val isDistributedPruningEnabled = CarbonProperties.getInstance()
+      .isDistributedPruningEnabled("", "")
+    if (!isDistributedPruningEnabled) {
+      getAllTablesCache(sparkSession)
+    }
+    else {
+      // get all the executor details from the index server
+      try {
+        val executorCacheValue = executeJobToGetCache(showExecutorCache, 
List())
+        val result = executorCacheValue.flatMap {
+          iterator =>
+            Seq(Row(iterator._1, bytesToDisplaySize(iterator._3)))
+        }
+        result
+      }
+      catch {
+        case ex: Exception =>
+          LOGGER.error("Error while getting cache from the Index Server", ex)
+          Seq()
+      }
+    }
+  }
+
   def getAllTablesCache(sparkSession: SparkSession): Seq[Row] = {
     val currentDatabase = sparkSession.sessionState.catalog.getCurrentDatabase
     val cache = CacheProvider.getInstance().getCarbonCache
     val isDistributedPruningEnabled = CarbonProperties.getInstance()
       .isDistributedPruningEnabled("", "")
-    if (cache == null && !isDistributedPruningEnabled) {
-      return makeEmptyCacheRows(currentDatabase)
+    if (!isDistributedPruningEnabled) {
+      if (cache == null) {
+        return makeEmptyCacheRows(currentDatabase, "DRIVER")
+      }
+      if (cache.getCurrentSize == 0) {
 
 Review comment:
   done

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to