Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public static BulkLoadJob fromLoadStmt(LoadStmt stmt) throws DdlException {
bulkLoadJob.setComment(stmt.getComment());
bulkLoadJob.setJobProperties(stmt.getProperties());
bulkLoadJob.checkAndSetDataSourceInfo((Database) db, stmt.getDataDescriptions());
// In the construction method, there may not be table information yet
bulkLoadJob.rebuildAuthorizationInfo();
return bulkLoadJob;
} catch (MetaNotFoundException e) {
throw new DdlException(e.getMessage());
Expand Down Expand Up @@ -172,6 +174,10 @@ private AuthorizationInfo gatherAuthInfo() throws MetaNotFoundException {
return new AuthorizationInfo(database.getFullName(), getTableNames());
}

public void rebuildAuthorizationInfo() throws MetaNotFoundException {
this.authorizationInfo = gatherAuthInfo();
}

@Override
public Set<String> getTableNamesForShow() {
Optional<Database> db = Env.getCurrentInternalCatalog().getDb(dbId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ public void cancelJob(FailMsg failMsg) throws DdlException {
}
}

private void checkAuth(String command) throws DdlException {
public void checkAuth(String command) throws DdlException {
if (authorizationInfo == null) {
// use the old method to check priv
checkAuthWithoutAuthInfo(command);
Expand Down Expand Up @@ -754,8 +754,6 @@ public void unprotectReadEndOperation(LoadJobFinalOperation loadJobFinalOperatio
public List<Comparable> getShowInfo() throws DdlException {
readLock();
try {
// check auth
checkAuth("SHOW LOAD");
List<Comparable> jobInfo = Lists.newArrayList();
// jobId
jobInfo.add(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,12 @@ public List<List<Comparable>> getLoadJobInfosByDb(long dbId, String labelValue,
if (!states.contains(loadJob.getState())) {
continue;
}
// check auth
try {
loadJob.checkAuth("show load");
} catch (DdlException e) {
continue;
}
// add load job info
loadJobInfos.add(loadJob.getShowInfo());
} catch (RuntimeException | DdlException e) {
Expand Down