Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2113#discussion_r181665755
--- Diff:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonDataMapShowCommand.scala
---
@@ -40,35 +42,48 @@ case class CarbonDataMapShowCommand(tableIdentifier:
Option[TableIdentifier])
override def output: Seq[Attribute] = {
Seq(AttributeReference("DataMapName", StringType, nullable = false)(),
AttributeReference("ClassName", StringType, nullable = false)(),
- AttributeReference("Associated Table", StringType, nullable =
false)())
+ AttributeReference("Associated Table", StringType, nullable =
false)(),
+ AttributeReference("DMProperties", StringType, nullable = false)())
}
override def processData(sparkSession: SparkSession): Seq[Row] = {
+ val finalSchemaList: util.List[DataMapSchema] = new
util.ArrayList[DataMapSchema]()
tableIdentifier match {
case Some(table) =>
Checker.validateTableExists(table.database, table.table,
sparkSession)
val carbonTable = CarbonEnv.getCarbonTable(table)(sparkSession)
if (carbonTable.hasDataMapSchema) {
- val schemaList = carbonTable.getTableInfo.getDataMapSchemaList
- convertToRow(schemaList)
- } else {
-
convertToRow(DataMapStoreManager.getInstance().getAllDataMapSchemas(carbonTable))
+
finalSchemaList.addAll(carbonTable.getTableInfo.getDataMapSchemaList)
+ }
+ val indexSchemas =
DataMapStoreManager.getInstance().getAllDataMapSchemas(carbonTable)
+ if (!indexSchemas.isEmpty) {
+ finalSchemaList.addAll(indexSchemas)
}
+ convertToRow(finalSchemaList)
case _ =>
convertToRow(DataMapStoreManager.getInstance().getAllDataMapSchemas)
}
-
}
private def convertToRow(schemaList: util.List[DataMapSchema]) = {
if (schemaList != null && schemaList.size() > 0) {
schemaList.asScala.map { s =>
var table = "(NA)"
val relationIdentifier = s.getRelationIdentifier
- if (relationIdentifier != null) {
+ var dmProperties = "(NA)"
+ val isFGorCGdm =
--- End diff --
For show datamap command, I think just show the shortname and the main table
And we should have desc datamap command, which I think we should add in
other PR
---