codope commented on a change in pull request #4693:
URL: https://github.com/apache/hudi/pull/4693#discussion_r838101454



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java
##########
@@ -925,6 +928,53 @@ public boolean scheduleCompactionAtInstant(String 
instantTime, Option<Map<String
     return scheduleTableService(instantTime, extraMetadata, 
TableServiceType.COMPACT).isPresent();
   }
 
+
+  /**
+   * Schedules INDEX action.
+   *
+   * @param partitionTypes - list of {@link MetadataPartitionType} which needs 
to be indexed
+   * @return instant time for the requested INDEX action
+   */
+  public Option<String> scheduleIndexing(List<MetadataPartitionType> 
partitionTypes) {
+    String instantTime = HoodieActiveTimeline.createNewInstantTime();
+    Option<HoodieIndexPlan> indexPlan = createTable(config, hadoopConf, 
config.isMetadataTableEnabled())
+        .scheduleIndex(context, instantTime, partitionTypes);
+    return indexPlan.isPresent() ? Option.of(instantTime) : Option.empty();
+  }
+
+  /**
+   * Runs INDEX action to build out the metadata partitions as planned for the 
given instant time.
+   *
+   * @param indexInstantTime - instant time for the requested INDEX action
+   * @return {@link Option<HoodieIndexCommitMetadata>} after successful 
indexing.
+   */
+  public Option<HoodieIndexCommitMetadata> index(String indexInstantTime) {
+    return createTable(config, hadoopConf, 
config.isMetadataTableEnabled()).index(context, indexInstantTime);
+  }
+
+  /**
+   * Drops the index and removes the metadata partitions.
+   *
+   * @param partitionTypes - list of {@link MetadataPartitionType} which needs 
to be indexed
+   */
+  public void dropIndex(List<MetadataPartitionType> partitionTypes) {

Review comment:
       will add a test for dropIndex.. the scheduleIndex and buildIndex APIs 
are covered in a deltastreamer test. i'll add more failure scenarios in 
TestHoodieIndexer.

##########
File path: 
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
##########
@@ -123,6 +123,22 @@ public static void deleteMetadataTable(String basePath, 
HoodieEngineContext cont
     }
   }
 
+  /**
+   * Check if the given metadata partition exists.
+   *
+   * @param basePath base path of the dataset
+   * @param context  instance of {@link HoodieEngineContext}.
+   */
+  public static boolean metadataPartitionExists(String basePath, 
HoodieEngineContext context, MetadataPartitionType partitionType) {

Review comment:
       this is called only in the table upgrade path.




-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to