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


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/HoodieSparkIndexClient.java:
##########
@@ -150,7 +162,16 @@ 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) && ignoreIfExists) {

Review Comment:
   🤖 nit: the `&&` guard here reads differently from the nested-if pattern used 
in `createRecordIndex` (line ~117). A future reader might wonder what happens 
when `indexExists && !ignoreIfExists` — not immediately obvious that the throw 
is handled further down. Could you use the same nested-if shape for 
consistency, e.g. `if (indexExists(...)) { if (ignoreIfExists) { return; } }`?
   
   <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