lokeshj1703 commented on code in PR #12266:
URL: https://github.com/apache/hudi/pull/12266#discussion_r1850652611
##########
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:
Yes, index name, type and source fields on which index is defined
--
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]