QiangCai commented on a change in pull request #3409: [CARBONDATA-3544] cli 
support summary statistics for all columns
URL: https://github.com/apache/carbondata/pull/3409#discussion_r333845959
 
 

 ##########
 File path: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonCliCommand.scala
 ##########
 @@ -49,12 +49,22 @@ case class CarbonCliCommand(
     val carbonTable = CarbonEnv.getCarbonTable(databaseNameOp, 
tableName)(sparkSession)
     setAuditTable(carbonTable)
     setAuditInfo(Map("options" -> commandOptions))
-    val commandArgs: Seq[String] = commandOptions.split("\\s+")
-    val finalCommands = commandArgs.collect {
-      case a if a.trim.equalsIgnoreCase("summary") || 
a.trim.equalsIgnoreCase("benchmark") =>
-        Seq(a, "-p", carbonTable.getTablePath)
-      case x => Seq(x.trim)
-    }.flatten
+    val commandArgs: Seq[String] = commandOptions.split("\\s+").map(_.trim)
+    commandArgs.exists { comand =>
+      comand.equalsIgnoreCase("-p")
+    }
+    val finalCommands = if (commandArgs.exists(_.equalsIgnoreCase("-p"))) {
+      commandArgs
+    } else {
+      val needPath = commandArgs.exists { command =>
+        command.equalsIgnoreCase("summary") || 
command.equalsIgnoreCase("benchmark")
+      }
+      if (needPath) {
+        commandArgs ++ Seq("-p", carbonTable.getTablePath)
+      } else {
+        commandArgs
+      }
+    }
 
 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