yuqi1129 commented on code in PR #12828:
URL: https://github.com/apache/gravitino/pull/12828#discussion_r4046222528
##########
catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java:
##########
@@ -1035,11 +1066,14 @@ static String addIndexDefinition(TableChange.AddIndex
addIndex) {
static String deleteIndexDefinition(
JdbcTable lazyLoadTable, TableChange.DeleteIndex deleteIndex) {
- if (!deleteIndex.isIfExists()) {
- Preconditions.checkArgument(
- Arrays.stream(lazyLoadTable.index())
- .anyMatch(index -> index.name().equals(deleteIndex.getName())),
- "Index does not exist");
+ boolean indexExists =
+ Arrays.stream(lazyLoadTable.index())
+ .anyMatch(index -> index.name().equals(deleteIndex.getName()));
+ if (!indexExists) {
+ if (deleteIndex.isIfExists()) {
+ return "";
+ }
+ Preconditions.checkArgument(false, "Index does not exist");
Review Comment:
This kind of code style is a little odd; `new IllegalArgumentException` is
clearer and more straightforward.
--
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]