Skip to content

Commit dcf3118

Browse files
committed
HIVE-29244: Add catalog field into ShowLocksRequest
1 parent 38a9635 commit dcf3118

84 files changed

Lines changed: 1905 additions & 869 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ public enum ErrorMsg {
500500
CATALOG_NOT_EXISTS(10445, "Catalog {0} does not exists:", true),
501501
INVALID_SCHEDULED_QUERY(10446, "Scheduled query {0} does not exist", true),
502502
UNSUPPORTED_TIMESTAMP_PRECISION(10447, "Unsupported value for precision: {0}", true),
503+
TABLE_NOT_EXISTS(10448, "Table does not exist."),
503504

504505
//========================== 20000 range starts here ========================//
505506

iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/MetastoreLock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class MetastoreLock implements HiveLock {
7878

7979
private final ClientPool<IMetaStoreClient, TException> metaClients;
8080

81+
private final String catalogName;
8182
private final String databaseName;
8283
private final String tableName;
8384
private final String fullName;
@@ -100,6 +101,7 @@ public MetastoreLock(Configuration conf, ClientPool<IMetaStoreClient, TException
100101
String catalogName, String databaseName, String tableName) {
101102
this.metaClients = metaClients;
102103
this.fullName = catalogName + "." + databaseName + "." + tableName;
104+
this.catalogName = catalogName;
103105
this.databaseName = databaseName;
104106
this.tableName = tableName;
105107

@@ -276,7 +278,7 @@ private LockInfo createLock() throws LockException {
276278
}
277279

278280
LockComponent lockComponent =
279-
new LockComponent(LockType.EXCL_WRITE, LockLevel.TABLE, databaseName);
281+
new LockComponent(LockType.EXCL_WRITE, LockLevel.TABLE, catalogName, databaseName);
280282
lockComponent.setTablename(tableName);
281283
LockRequest lockRequest =
282284
new LockRequest(

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/BaseReplicationScenariosAcidTables.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class BaseReplicationScenariosAcidTables {
7474
static WarehouseInstance primary;
7575
static WarehouseInstance replica, replicaNonAcid;
7676
static HiveConf conf;
77+
String primaryCatName = "hive";
7778
String primaryDbName, replicatedDbName;
7879
List<String> acidTableNames = new LinkedList<>();
7980
private List<String> nonAcidTableNames = new LinkedList<>();
@@ -348,7 +349,7 @@ List<Long> openTxns(int numTxns, TxnStore txnHandler, HiveConf primaryConf) thro
348349
return txns;
349350
}
350351

351-
List<Long> allocateWriteIdsForTablesAndAcquireLocks(String primaryDbName, Map<String, Long> tables,
352+
List<Long> allocateWriteIdsForTablesAndAcquireLocks(String primaryCatName, String primaryDbName, Map<String, Long> tables,
352353
TxnStore txnHandler,
353354
List<Long> txns, HiveConf primaryConf) throws Throwable {
354355
AllocateTableWriteIdsRequest rqst = new AllocateTableWriteIdsRequest();
@@ -360,7 +361,7 @@ List<Long> allocateWriteIdsForTablesAndAcquireLocks(String primaryDbName, Map<St
360361
txnHandler.allocateTableWriteIds(rqst);
361362
for (long txnId : txns) {
362363
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE,
363-
primaryDbName);
364+
primaryCatName, primaryDbName);
364365
comp.setTablename(entry.getKey());
365366
comp.setOperationType(DataOperationType.UPDATE);
366367
List<LockComponent> components = new ArrayList<LockComponent>(1);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationOptimisedBootstrap.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ public void testReverseBootstrap() throws Throwable {
563563
Map<String, Long> tablesInSecDb = new HashMap<>();
564564
tablesInSecDb.put("t1", (long) numTxnsForSecDb + 4);
565565
tablesInSecDb.put("t2", (long) numTxnsForSecDb + 4);
566-
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
566+
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
567567
tablesInSecDb, txnHandler, txnsForSecDb, primaryConf);
568568
tearDownLockIds.addAll(lockIdsForSecDb);
569569

@@ -576,7 +576,7 @@ public void testReverseBootstrap() throws Throwable {
576576
Map<String, Long> tablesInSourceDb = new HashMap<>();
577577
tablesInSourceDb.put("t1", (long) numTxnsForPrimaryDb + 6);
578578
tablesInSourceDb.put("t2", (long) numTxnsForPrimaryDb);
579-
List<Long> lockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(replicatedDbName, tablesInSourceDb, txnHandler,
579+
List<Long> lockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, replicatedDbName, tablesInSourceDb, txnHandler,
580580
txnsForSourceDb, replica.getConf());
581581
tearDownLockIds.addAll(lockIdsForSourceDb);
582582

@@ -1092,7 +1092,7 @@ private List<String> setUpFirstIterForOptimisedBootstrap() throws Throwable {
10921092
Map<String, Long> tablesInSecDb = new HashMap<>();
10931093
tablesInSecDb.put("t1", (long) numTxnsForSecDb);
10941094
tablesInSecDb.put("t2", (long) numTxnsForSecDb);
1095-
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
1095+
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
10961096
tablesInSecDb, txnHandler, txnsForSecDb, primaryConf);
10971097
tearDownLockIds.addAll(lockIdsForSecDb);
10981098

@@ -1105,7 +1105,7 @@ private List<String> setUpFirstIterForOptimisedBootstrap() throws Throwable {
11051105
Map<String, Long> tablesInSourceDb = new HashMap<>();
11061106
tablesInSourceDb.put("t1", (long) numTxnsForPrimaryDb);
11071107
tablesInSourceDb.put("t5", (long) numTxnsForPrimaryDb);
1108-
List<Long> lockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName, tablesInSourceDb, txnHandler,
1108+
List<Long> lockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName, tablesInSourceDb, txnHandler,
11091109
txnsForSourceDb, primary.getConf());
11101110
tearDownLockIds.addAll(lockIdsForSourceDb);
11111111

@@ -1157,7 +1157,7 @@ private List<String> setUpFirstIterForOptimisedBootstrap() throws Throwable {
11571157
Map<String, Long> newTablesForSecDb = new HashMap<>();
11581158
newTablesForSecDb.put("t1", (long) numTxnsForSecDb + 1);
11591159
newTablesForSecDb.put("t2", (long) numTxnsForSecDb + 1);
1160-
List<Long> newLockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
1160+
List<Long> newLockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
11611161
newTablesForSecDb, txnHandler, newTxnsForSecDb, primaryConf);
11621162
tearDownLockIds.addAll(newLockIdsForSecDb);
11631163

@@ -1169,7 +1169,7 @@ private List<String> setUpFirstIterForOptimisedBootstrap() throws Throwable {
11691169
Map<String, Long> newTablesInSourceDb = new HashMap<>();
11701170
newTablesInSourceDb.put("t1", (long) 5);
11711171
newTablesInSourceDb.put("t5", (long) 3);
1172-
List<Long> newLockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName, newTablesInSourceDb, txnHandler,
1172+
List<Long> newLockIdsForSourceDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName, newTablesInSourceDb, txnHandler,
11731173
newTxnsForSourceDb, primary.getConf());
11741174
tearDownLockIds.addAll(newLockIdsForSourceDb);
11751175

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public void testCompleteFailoverWithReverseBootstrap() throws Throwable {
524524
Map<String, Long> tablesInSecDb = new HashMap<>();
525525
tablesInSecDb.put("t1", (long) numTxnsForSecDb);
526526
tablesInSecDb.put("t2", (long) numTxnsForSecDb);
527-
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
527+
List<Long> lockIdsForSecDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
528528
tablesInSecDb, txnHandler, txnsForSecDb, primaryConf);
529529

530530
//Open 2 txns for Primary Db
@@ -536,7 +536,7 @@ public void testCompleteFailoverWithReverseBootstrap() throws Throwable {
536536
Map<String, Long> tablesInPrimaryDb = new HashMap<>();
537537
tablesInPrimaryDb.put("t1", (long) numTxnsForPrimaryDb + 1);
538538
tablesInPrimaryDb.put("t2", (long) numTxnsForPrimaryDb + 2);
539-
List<Long> lockIdsForPrimaryDb = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName,
539+
List<Long> lockIdsForPrimaryDb = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName,
540540
tablesInPrimaryDb, txnHandler, txnsForPrimaryDb, primaryConf);
541541

542542
//Open 1 txn with no hive locks acquired
@@ -1508,7 +1508,7 @@ public void testAcidTablesBootstrapWithOpenTxnsTimeout() throws Throwable {
15081508
Map<String, Long> tables = new HashMap<>();
15091509
tables.put("t1", numTxns + 1L);
15101510
tables.put("t2", numTxns + 2L);
1511-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName, tables, txnHandler, txns, primaryConf);
1511+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName, tables, txnHandler, txns, primaryConf);
15121512

15131513
// Bootstrap dump with open txn timeout as 1s.
15141514
List<String> withConfigs = Arrays.asList(
@@ -1627,7 +1627,7 @@ public void testAcidTablesBootstrapWithOpenTxnsDiffDb() throws Throwable {
16271627
Map<String, Long> tablesInSecDb = new HashMap<>();
16281628
tablesInSecDb.put("t1", (long) numTxns);
16291629
tablesInSecDb.put("t2", (long) numTxns);
1630-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
1630+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
16311631
tablesInSecDb, txnHandler, txns, primaryConf);
16321632

16331633
// Bootstrap dump with open txn timeout as 300s.
@@ -1723,7 +1723,7 @@ public void testAcidTablesBootstrapWithOpenTxnsWaitingForLock() throws Throwable
17231723
Map<String, Long> tablesInSecDb = new HashMap<>();
17241724
tablesInSecDb.put("t1", (long) numTxns);
17251725
tablesInSecDb.put("t2", (long) numTxns);
1726-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
1726+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
17271727
tablesInSecDb, txnHandler, txns, primaryConf);
17281728

17291729
WarehouseInstance.Tuple bootstrapDump = primary
@@ -1789,14 +1789,14 @@ public void testAcidTablesBootstrapWithOpenTxnsPrimaryAndSecondaryDb() throws Th
17891789
Map<String, Long> tablesInSecDb = new HashMap<>();
17901790
tablesInSecDb.put("t1", (long) numTxns);
17911791
tablesInSecDb.put("t2", (long) numTxns);
1792-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName + "_extra",
1792+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName + "_extra",
17931793
tablesInSecDb, txnHandler, txns, primaryConf);
17941794
// Allocate write ids for both tables of primary db for all txns
17951795
// t1=5+1L and t2=5+2L inserts
17961796
Map<String, Long> tablesInPrimDb = new HashMap<>();
17971797
tablesInPrimDb.put("t1", (long) numTxns + 1L);
17981798
tablesInPrimDb.put("t2", (long) numTxns + 2L);
1799-
lockIds.addAll(allocateWriteIdsForTablesAndAcquireLocks(primaryDbName,
1799+
lockIds.addAll(allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName,
18001800
tablesInPrimDb, txnHandler, txnsSameDb, primaryConf));
18011801

18021802
// Bootstrap dump with open txn timeout as 1s.
@@ -1864,7 +1864,7 @@ public void testAcidTablesBootstrapWithOpenTxnsAbortDisabled() throws Throwable
18641864
Map<String, Long> tables = new HashMap<>();
18651865
tables.put("t1", numTxns + 1L);
18661866
tables.put("t2", numTxns + 2L);
1867-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName, tables, txnHandler, txns, primaryConf);
1867+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName, tables, txnHandler, txns, primaryConf);
18681868

18691869
// Bootstrap dump with open txn timeout as 1s.
18701870
List<String> withConfigs = Arrays.asList(

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTablesBootstrap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void testAcidTablesBootstrapDuringIncrementalWithOpenTxnsTimeout() throws
200200
Map<String, Long> tables = new HashMap<>();
201201
tables.put("t1", numTxns+2L);
202202
tables.put("t2", numTxns+6L);
203-
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryDbName, tables, txnHandler, txns, primaryConf);
203+
List<Long> lockIds = allocateWriteIdsForTablesAndAcquireLocks(primaryCatName, primaryDbName, tables, txnHandler, txns, primaryConf);
204204

205205
// Bootstrap dump with open txn timeout as 1s.
206206
List<String> withConfigs = new LinkedList<>(dumpWithAcidBootstrapClause);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator2.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
public class TestInitiator2 extends CompactorTest {
3232
@Test
3333
public void dbNoAutoCompactSetTrue() throws Exception {
34+
String catName = "hive";
3435
String dbName = "test";
3536
Map<String, String> dbParams = new HashMap<String, String>(1);
3637
dbParams.put("no_auto_compaction", "true");
@@ -44,7 +45,7 @@ public void dbNoAutoCompactSetTrue() throws Exception {
4445

4546
for (int i = 0; i < 11; i++) {
4647
long txnid = openTxn();
47-
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, dbName);
48+
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, catName, dbName);
4849
comp.setTablename("dbnacst");
4950
comp.setOperationType(DataOperationType.UPDATE);
5051
List<LockComponent> components = new ArrayList<LockComponent>(1);
@@ -64,6 +65,7 @@ public void dbNoAutoCompactSetTrue() throws Exception {
6465
@Test
6566
public void dbNoAutoCompactSetFalseUpperCase() throws Exception {
6667
boolean useCleanerForAbortCleanup = MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.COMPACTOR_CLEAN_ABORTS_USING_CLEANER);
68+
String catName = "hive";
6769
String dbName = "test1";
6870
Map<String, String> params = new HashMap<String, String>(1);
6971
params.put("NO_AUTO_COMPACTION", "false");
@@ -77,7 +79,7 @@ public void dbNoAutoCompactSetFalseUpperCase() throws Exception {
7779

7880
for (int i = 0; i < 11; i++) {
7981
long txnid = openTxn();
80-
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, dbName);
82+
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, catName, dbName);
8183
comp.setTablename("dbnacsf");
8284
comp.setOperationType(DataOperationType.UPDATE);
8385
List<LockComponent> components = new ArrayList<LockComponent>(1);

itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestMaterializedViewRebuild.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private void assertResult(List<String> expected, List<String> actual) {
198198
public void testMaterializationLockCleaned() throws Exception {
199199
TxnStore txnHandler = TxnUtils.getTxnStore(conf);
200200
OpenTxnsResponse response = txnHandler.openTxns(new OpenTxnRequest(1, "user", "host"));
201-
txnHandler.lockMaterializationRebuild("default", TABLE1, response.getTxn_ids().get(0));
201+
txnHandler.lockMaterializationRebuild("hive", "default", TABLE1, response.getTxn_ids().get(0));
202202

203203
//Mimic the lock can be cleaned up
204204
ValidTxnList validTxnList = Mockito.mock(ValidReadTxnList.class);

parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ inputFileFormat
12651265
tabTypeExpr
12661266
@init { pushMsg("specifying table types", state); }
12671267
@after { popMsg(state); }
1268-
: identifier (DOT^ identifier)?
1268+
: identifier (DOT^ identifier (DOT^ identifier)?)?
12691269
(identifier (DOT^
12701270
(
12711271
(KW_ELEM_TYPE) => KW_ELEM_TYPE
@@ -1346,7 +1346,7 @@ showStatement
13461346
| KW_SHOW KW_TBLPROPERTIES tableName (LPAREN prptyName=StringLiteral RPAREN)? -> ^(TOK_SHOW_TBLPROPERTIES tableName $prptyName?)
13471347
| KW_SHOW KW_LOCKS
13481348
(
1349-
(KW_DATABASE|KW_SCHEMA) => (KW_DATABASE|KW_SCHEMA) (dbName=identifier) (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWDBLOCKS $dbName $isExtended?)
1349+
(KW_DATABASE|KW_SCHEMA) => (KW_DATABASE|KW_SCHEMA) (name=databaseName) (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWDBLOCKS $name $isExtended?)
13501350
|
13511351
(parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS $parttype? $isExtended?)
13521352
)

ql/src/java/org/apache/hadoop/hive/ql/ddl/table/lock/show/ShowLocksAnalyzer.java

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818

1919
package org.apache.hadoop.hive.ql.ddl.table.lock.show;
2020

21+
import java.util.Arrays;
22+
import java.util.List;
2123
import java.util.Map;
2224

25+
import org.apache.hadoop.hive.ql.ErrorMsg;
2326
import org.apache.hadoop.hive.ql.QueryState;
2427
import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType;
2528
import org.apache.hadoop.hive.ql.ddl.DDLUtils;
@@ -30,6 +33,7 @@
3033
import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
3134
import org.apache.hadoop.hive.ql.parse.HiveParser;
3235
import org.apache.hadoop.hive.ql.parse.SemanticException;
36+
import org.apache.hadoop.hive.ql.session.SessionState;
3337

3438
/**
3539
* Analyzer for show locks commands.
@@ -44,29 +48,56 @@ public ShowLocksAnalyzer(QueryState queryState) throws SemanticException {
4448
public void analyzeInternal(ASTNode root) throws SemanticException {
4549
ctx.setResFile(ctx.getLocalTmpPath());
4650

47-
String tableName = null;
51+
String fullyQualifiedTableName = null;
4852
Map<String, String> partitionSpec = null;
4953
boolean isExtended = false;
5054
if (root.getChildCount() >= 1) {
5155
// table for which show locks is being executed
5256
for (int i = 0; i < root.getChildCount(); i++) {
5357
ASTNode child = (ASTNode) root.getChild(i);
5458
if (child.getType() == HiveParser.TOK_TABTYPE) {
55-
tableName = DDLUtils.getFQName((ASTNode) child.getChild(0));
59+
fullyQualifiedTableName = DDLUtils.getFQName((ASTNode) child.getChild(0));
5660
// get partition metadata if partition specified
5761
if (child.getChildCount() == 2) {
5862
ASTNode partitionSpecNode = (ASTNode) child.getChild(1);
59-
partitionSpec = getValidatedPartSpec(getTable(tableName), partitionSpecNode, conf, false);
63+
partitionSpec = getValidatedPartSpec(getTable(fullyQualifiedTableName), partitionSpecNode, conf, false);
6064
}
6165
} else if (child.getType() == HiveParser.KW_EXTENDED) {
6266
isExtended = true;
6367
}
6468
}
6569
}
6670

71+
String catalogName = null;
72+
String dbName = null;
73+
String tableName = null;
74+
75+
if (fullyQualifiedTableName != null) {
76+
List<String> splitFullyQualifiedTableName = Arrays.stream(fullyQualifiedTableName.split("\\.")).toList();
77+
if (splitFullyQualifiedTableName.size() == 1) {
78+
catalogName = SessionState.get().getCurrentCatalog();
79+
dbName = SessionState.get().getCurrentDatabase();
80+
tableName = splitFullyQualifiedTableName.get(0);
81+
} else if (splitFullyQualifiedTableName.size() == 2) {
82+
catalogName = SessionState.get().getCurrentCatalog();
83+
dbName = splitFullyQualifiedTableName.get(0);
84+
tableName = splitFullyQualifiedTableName.get(1);
85+
} else {
86+
catalogName = splitFullyQualifiedTableName.get(0);
87+
dbName = splitFullyQualifiedTableName.get(1);
88+
tableName = splitFullyQualifiedTableName.get(2);
89+
}
90+
91+
if (getCatalog(catalogName) == null) {
92+
throw new SemanticException(ErrorMsg.CATALOG_NOT_EXISTS, catalogName);
93+
} else if (getDatabase(catalogName, dbName, true) == null) {
94+
throw new SemanticException(ErrorMsg.DATABASE_NOT_EXISTS);
95+
}
96+
}
97+
6798
assert txnManager != null : "Transaction manager should be set before calling analyze";
6899
ShowLocksDesc desc =
69-
new ShowLocksDesc(ctx.getResFile(), tableName, partitionSpec, isExtended, txnManager.useNewShowLocksFormat());
100+
new ShowLocksDesc(ctx.getResFile(), catalogName, dbName, tableName, partitionSpec, isExtended, txnManager.useNewShowLocksFormat());
70101
Task<DDLWork> task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc));
71102
rootTasks.add(task);
72103

0 commit comments

Comments
 (0)