deniskuzZ commented on code in PR #6088:
URL: https://github.com/apache/hive/pull/6088#discussion_r2454566534
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/database/drop/DropDatabaseAnalyzer.java:
##########
@@ -51,12 +53,17 @@ public DropDatabaseAnalyzer(QueryState queryState) throws
SemanticException {
@Override
public void analyzeInternal(ASTNode root) throws SemanticException {
- String databaseName = unescapeIdentifier(root.getChild(0).getText());
+ Pair<String, String> catDbNamePair = getCatDbNamePair((ASTNode)
root.getChild(0));
boolean ifExists = root.getFirstChildWithType(HiveParser.TOK_IFEXISTS) !=
null;
boolean cascade = root.getFirstChildWithType(HiveParser.TOK_CASCADE) !=
null;
boolean isSoftDelete = HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
- Database database = getDatabase(databaseName, !ifExists);
+ String catalogName = catDbNamePair.getLeft();
+ if (catalogName != null && getCatalog(catalogName) == null) {
+ throw new SemanticException(ErrorMsg.CATALOG_NOT_EXISTS, catalogName);
+ }
+ String databaseName = catDbNamePair.getRight();
+ Database database = getDatabase(catDbNamePair.getLeft(),
catDbNamePair.getRight(), !ifExists);
Review Comment:
why not use loval vars?
````
getDatabase(catalogName, databaseName, !ifExists)
````
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/database/drop/DropDatabaseAnalyzer.java:
##########
@@ -51,12 +53,17 @@ public DropDatabaseAnalyzer(QueryState queryState) throws
SemanticException {
@Override
public void analyzeInternal(ASTNode root) throws SemanticException {
- String databaseName = unescapeIdentifier(root.getChild(0).getText());
+ Pair<String, String> catDbNamePair = getCatDbNamePair((ASTNode)
root.getChild(0));
boolean ifExists = root.getFirstChildWithType(HiveParser.TOK_IFEXISTS) !=
null;
boolean cascade = root.getFirstChildWithType(HiveParser.TOK_CASCADE) !=
null;
boolean isSoftDelete = HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
- Database database = getDatabase(databaseName, !ifExists);
+ String catalogName = catDbNamePair.getLeft();
+ if (catalogName != null && getCatalog(catalogName) == null) {
+ throw new SemanticException(ErrorMsg.CATALOG_NOT_EXISTS, catalogName);
+ }
+ String databaseName = catDbNamePair.getRight();
+ Database database = getDatabase(catDbNamePair.getLeft(),
catDbNamePair.getRight(), !ifExists);
Review Comment:
why not use local vars?
````
getDatabase(catalogName, databaseName, !ifExists)
````
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]