You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/07/24 14:05:23 UTC
[doris] branch branch-2.0 updated: [bugfix](auth)fix db is null when table instanceof FunctionGenTable (#22147)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new d9eaa1d94d [bugfix](auth)fix db is null when table instanceof FunctionGenTable (#22147)
d9eaa1d94d is described below
commit d9eaa1d94d36f8e028c48718cf97c524a95faf62
Author: zhangdong <49...@qq.com>
AuthorDate: Mon Jul 24 22:05:15 2023 +0800
[bugfix](auth)fix db is null when table instanceof FunctionGenTable (#22147)
bug generate by: #22019
---
.../doris/nereids/rules/analysis/UserAuthentication.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/UserAuthentication.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/UserAuthentication.java
index 04723a1e9c..9ad3edc683 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/UserAuthentication.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/UserAuthentication.java
@@ -17,8 +17,10 @@
package org.apache.doris.nereids.rules.analysis;
+import org.apache.doris.catalog.DatabaseIf;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.ErrorCode;
+import org.apache.doris.datasource.CatalogIf;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.rules.Rule;
@@ -49,8 +51,17 @@ public class UserAuthentication extends OneAnalysisRuleFactory {
return relation;
}
String tableName = table.getName();
- String dbName = table.getDatabase().getFullName();
- String ctlName = table.getDatabase().getCatalog().getName();
+ DatabaseIf db = table.getDatabase();
+ // when table inatanceof FunctionGenTable,db will be null
+ if (db == null) {
+ return relation;
+ }
+ String dbName = db.getFullName();
+ CatalogIf catalog = db.getCatalog();
+ if (catalog == null) {
+ return relation;
+ }
+ String ctlName = catalog.getName();
// TODO: 2023/7/19 checkColumnsPriv
if (!connectContext.getEnv().getAccessManager().checkTblPriv(connectContext, ctlName, dbName,
tableName, PrivPredicate.SELECT)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org