vinothchandar commented on code in PR #12266:
URL: https://github.com/apache/hudi/pull/12266#discussion_r1850207259


##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -195,23 +195,28 @@ protected HoodieTableMetaClient(HoodieStorage storage, 
String basePath, boolean
   public HoodieTableMetaClient() {
   }
 
+  public String getIndexDefinitionPath() {

Review Comment:
   UT this method



##########
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java:
##########
@@ -312,6 +312,11 @@ private static void 
constructColumnStatsMetadataPayload(HoodieMetadataPayload pa
     }
   }
 
+  public static boolean isGenericIndex(String metadataPartitionPath) {

Review Comment:
   UT



##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/IndexCommands.scala:
##########
@@ -90,31 +97,36 @@ case class DropIndexCommand(table: CatalogTable,
   }
 }
 
+/**
+ * Command to show available indexes in hudi. The corresponding logical plan 
is available at
+ * org.apache.spark.sql.catalyst.plans.logical.ShowIndexes
+ */
 case class ShowIndexesCommand(table: CatalogTable,
                               override val output: Seq[Attribute]) extends 
IndexBaseCommand {
 
   override def run(sparkSession: SparkSession): Seq[Row] = {
     val metaClient = createHoodieTableMetaClient(table.identifier, 
sparkSession)
-    val secondaryIndexes = SecondaryIndexManager.getInstance().show(metaClient)
-
-    val mapper = JsonUtils.getObjectMapper
-    toScalaOption(secondaryIndexes).map(x =>
-      x.asScala.map(i => {
-        val colOptions =
-          if (i.getColumns.values().asScala.forall(_.isEmpty)) "" else 
mapper.writeValueAsString(i.getColumns)
-        val options = if (i.getOptions.isEmpty) "" else 
mapper.writeValueAsString(i.getOptions)
-        Row(i.getIndexName, i.getColumns.keySet().asScala.mkString(","),
-          i.getIndexType.name().toLowerCase, colOptions, options)
-      }).toSeq).getOrElse(Seq.empty[Row])
+    // need to ensure that the index name is for a valid partition type
+    metaClient.getTableConfig.getMetadataPartitions.asScala.map(

Review Comment:
   IIUC we show index name and type? 



##########
hudi-spark-datasource/hudi-spark-common/src/main/java/org/apache/hudi/HoodieSparkIndexClient.java:
##########
@@ -82,8 +82,10 @@ public static HoodieSparkIndexClient 
getInstance(SparkSession sparkSession) {
 
   @Override
   public void create(HoodieTableMetaClient metaClient, String indexName, 
String indexType, Map<String, Map<String, String>> columns, Map<String, String> 
options) {
-    indexName = indexType.equals(PARTITION_NAME_SECONDARY_INDEX) ? 
PARTITION_NAME_SECONDARY_INDEX_PREFIX + indexName : 
PARTITION_NAME_FUNCTIONAL_INDEX_PREFIX + indexName;
-    if (indexExists(metaClient, indexName)) {
+    String hoodieIndexName = indexType.equals(PARTITION_NAME_SECONDARY_INDEX)

Review Comment:
   rename : indexName. 



##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -81,6 +81,10 @@ public String getIndexType() {
     return indexType;
   }
 
+  public String getIndexNameWithoutPrefix() {
+    return indexName.substring(indexType.length() + 1);

Review Comment:
   lets UT (unit test) this method?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to