hudi-agent commented on code in PR #18699:
URL: https://github.com/apache/hudi/pull/18699#discussion_r3204049048


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/HoodieSparkIndexClient.java:
##########
@@ -150,7 +162,18 @@ public void 
createOrUpdateColumnStatsIndexDefinition(HoodieTableMetaClient metaC
   }
 
   private void createExpressionOrSecondaryIndex(HoodieTableMetaClient 
metaClient, String userIndexName, String indexType,
-                                                Map<String, Map<String, 
String>> columns, Map<String, String> options, Map<String, String> 
tableProperties) throws Exception {
+                                                Map<String, Map<String, 
String>> columns, Map<String, String> options, Map<String, String> 
tableProperties,
+                                                boolean ignoreIfExists) throws 
Exception {
+    String fullIndexName = indexType.equals(PARTITION_NAME_SECONDARY_INDEX)
+        ? PARTITION_NAME_SECONDARY_INDEX_PREFIX + userIndexName
+        : PARTITION_NAME_EXPRESSION_INDEX_PREFIX + userIndexName;
+    if (indexExists(metaClient, fullIndexName)) {

Review Comment:
   🤖 nit: since there's no `throw` after the inner branch (unlike 
`createRecordIndex`), this nested `if` is just a conjunction — could you 
flatten to `if (ignoreIfExists && indexExists(metaClient, fullIndexName)) { ... 
}` for readability?
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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