Skip to content

Commit

Permalink
[fix](load priv) modify error msg of checking table priv (apache#7817)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry2SS authored Feb 6, 2022
1 parent 9eb1d1d commit 2ffd7fc
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "ALTER COLUMN STATS",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName.getTbl());
tableName.getDb() + ": " + tableName.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "ALTER TABLE STATS",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName.getTbl());
tableName.getDb() + ": " + tableName.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "ALTER TABLE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tbl.getTbl());
tbl.getDb() + ": " + tbl.getTbl());
}
if (ops == null || ops.isEmpty()) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_ALTER_OPERATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "ALTER VIEW",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName.getTbl());
tableName.getDb() + ": " + tableName.getTbl());
}

if (cols != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "CANCEL ALTER TABLE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
dbTableName.getTbl());
dbTableName.getDb() + ": " + dbTableName.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void checkAuth(String fullDbName) throws AnalysisException {
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), targetTable);
ConnectContext.get().getRemoteIP(), fullDbName + ": " + targetTable);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ private void checkLoadPriv(String fullDbName) throws AnalysisException {
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tableName);
ConnectContext.get().getRemoteIP(), fullDbName + ": " + tableName);
}

// check hive table auth
Expand All @@ -798,7 +798,7 @@ private void checkLoadPriv(String fullDbName) throws AnalysisException {
PrivPredicate.SELECT)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SELECT",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), srcTableName);
ConnectContext.get().getRemoteIP(), fullDbName + ": " + srcTableName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void analyze(Analyzer analyzer) throws UserException {
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tbl.getTbl());
ConnectContext.get().getRemoteIP(), tbl.getDb() + ": " + tbl.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "DESCRIBE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
dbTableName.getTbl());
dbTableName.getDb() + ": " + dbTableName.getTbl());
}

Database db = Catalog.getCurrentCatalog().getDbOrAnalysisException(dbTableName.getDb());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "EXPORT",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tblName.getTbl());
tblName.getDb() + ": " + tblName.getTbl());
}

// check table && partitions whether exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void getTables(Analyzer analyzer, Map<Long, Table> tableMap, Set<String>
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tblName.getTbl());
ConnectContext.get().getRemoteIP(), dbName + ": " + tableName);
}

tableMap.put(table.getId(), table);
Expand Down Expand Up @@ -271,7 +271,7 @@ public void analyze(Analyzer analyzer) throws UserException {
tblName.getTbl(), PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tblName.getTbl());
ConnectContext.get().getRemoteIP(), tblName.getDb() + ": " + tblName.getTbl());
}

// check partition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SELECT",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbName + ": " + tableName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "RECOVERY",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
dbTblName.getTbl());
dbTblName.getDb() + ": " + dbTblName.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "RECOVERY",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
dbTblName.getTbl());
dbTblName.getDb() + ": " + dbTblName.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public void getTables(Analyzer analyzer, Map<Long, Table> tableMap, Set<String>
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SELECT",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tblRef.getName().getTbl());
dbName + ": " + tableName);
}
tableMap.put(table.getId(), table);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW CREATE TABLE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tbl.getTbl());
tbl.getDb() + ": " + tbl.getTbl());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public int compare(Table t1, Table t2) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW DATA",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbName + ": " + tableName);
}

OlapTable olapTable = db.getTableOrMetaException(tableName, TableType.OLAP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
if (!Catalog.getCurrentCatalog().getAuth().checkTblPriv(ConnectContext.get(), tableName.getDb(), tableName.getTbl(),
PrivPredicate.SHOW)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, analyzer.getQualifiedUser(),
tableName.toString());
tableName.getDb() + ": " + tableName.toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void analyze(Analyzer analyzer) throws UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW PARTITIONS",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbName + ": " + tableName);
}
Database db = Catalog.getCurrentCatalog().getDbOrAnalysisException(dbName);
Table table = db.getTableOrMetaException(tableName, Table.TableType.OLAP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW VIEW",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
getTbl());
dbName + ": " + getTbl());
}

Database database = Catalog.getCurrentCatalog().getDbOrAnalysisException(dbName);
Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/load/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ public boolean cancelLoadJob(CancelLoadStmt stmt, boolean isAccurateMatch) throw
PrivPredicate.LOAD)) {
ErrorReport.reportDdlException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "CANCEL LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tblName);
ConnectContext.get().getRemoteIP(), dbName + ": " + tblName);
}
}
}
Expand Down Expand Up @@ -1774,7 +1774,7 @@ public boolean cancelLoadJob(CancelLoadStmt stmt) throws DdlException {
PrivPredicate.LOAD)) {
ErrorReport.reportDdlException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "CANCEL LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tblName);
ConnectContext.get().getRemoteIP(), dbName + ": " + tblName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ private void checkAuthWithoutAuthInfo(String command) throws DdlException {
ErrorReport.reportDdlException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR,
command,
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(), tblName);
ConnectContext.get().getRemoteIP(), db.getFullName() + ": " + tblName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void createRoutineLoadJob(CreateRoutineLoadStmt createRoutineLoadStmt)
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
createRoutineLoadStmt.getDBName(),
createRoutineLoadStmt.getTableName());
createRoutineLoadStmt.getDBName() + ": " + createRoutineLoadStmt.getTableName());
}

RoutineLoadJob routineLoadJob = null;
Expand Down Expand Up @@ -226,7 +226,7 @@ public RoutineLoadJob checkPrivAndGetJob(String dbName, String jobName)
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbFullName + ": " + tableName);
}
return routineLoadJob;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ private void handleShowLoadWarnings() throws AnalysisException {
"SHOW LOAD WARNING",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tblName);
db.getFullName() + ": " + tblName);
}
}
}
Expand Down Expand Up @@ -1290,7 +1290,7 @@ private void handleShowRoutineLoadTask() throws AnalysisException {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbFullName + ": " + tableName);
}

// get routine load task info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public List<List<String>> showTableStatsList(String dbName, String tableName)
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW CREATE TABLE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName);
dbName + ": " + tableName);
}
// get stats
result.add(showTableStats(table));
Expand Down Expand Up @@ -100,7 +100,7 @@ public List<List<String>> showColumnStatsList(TableName tableName) throws Analys
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SHOW CREATE TABLE",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tableName.getTbl());
tableName.getDb() + ": " + tableName.getTbl());
}
// get stats
List<List<String>> result = Lists.newArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ public List<List<String>> getSingleTranInfo(long dbId, long txnId) throws Analys
"SHOW TRANSACTION",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
tbl.getName());
db.getFullName() + ": " + tbl.getName());
}
}
}
Expand Down

0 comments on commit 2ffd7fc

Please sign in to comment.