Skip to content

Commit

Permalink
[Chore](load) return error reason when database/table not founded whe…
Browse files Browse the repository at this point in the history
…n stream load (#38967)

## Proposed changes
return error reason when database/table not founded when stream load
  • Loading branch information
BiteTheDDDDt authored Aug 7, 2024
1 parent a5df5ee commit 3aadf92
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.net.URI;
import java.util.Enumeration;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -293,8 +294,17 @@ private Object executeWithoutPassword(HttpServletRequest request,
return new RestBaseResult(e.getMessage());
}
} else {
long tableId = ((OlapTable) ((Database) Env.getCurrentEnv().getCurrentCatalog().getDb(dbName)
.get()).getTable(tableName).get()).getId();
Optional<?> database = Env.getCurrentEnv().getCurrentCatalog().getDb(dbName);
if (!database.isPresent()) {
return new RestBaseResult("Database not founded.");
}

Optional<?> olapTable = ((Database) database.get()).getTable(tableName);
if (!olapTable.isPresent()) {
return new RestBaseResult("OlapTable not founded.");
}

long tableId = ((OlapTable) olapTable.get()).getId();
redirectAddr = selectRedirectBackend(request, groupCommit, tableId);
}

Expand Down

0 comments on commit 3aadf92

Please sign in to comment.