zhangbutao commented on code in PR #4292:
URL: https://github.com/apache/hive/pull/4292#discussion_r1204065743
##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -1751,15 +1751,22 @@ public Table getTable(final String dbName, final String
tableName, String metaTa
}
Table t = new Table(tTable);
- if (metaTableName != null) {
- if (t.getStorageHandler() == null ||
!t.getStorageHandler().isMetadataTableSupported()) {
- throw new SemanticException(ErrorMsg.METADATA_TABLE_NOT_SUPPORTED,
t.getTableName());
+ if (tableIdentifier != null) {
+ if (t.getStorageHandler() == null ||
!t.getStorageHandler().isTableIdentifierSupported()) {
+ throw new SemanticException(ErrorMsg.TABLE_IDENTIFIER_NOT_SUPPORTED,
t.getTableName());
}
- if (!t.getStorageHandler().isValidMetadataTable(metaTableName)) {
- throw new SemanticException(ErrorMsg.INVALID_METADATA_TABLE_NAME,
metaTableName);
+ if (tableIdentifier.startsWith("branch_")) {
+ if (!t.getStorageHandler().isValidBranch(tTable,
tableIdentifier.substring(7))) {
+ throw new SemanticException(String.format("Cannot use branch (does
not exist): %s", tableIdentifier.substring(7)));
+ }
+ t.setBranchName(tableIdentifier);
+ } else {
+ if (!t.getStorageHandler().isValidMetadataTable(tableIdentifier)) {
Review Comment:
@deniskuzZ Sorry for the confusion. I struggled here for a long time too.
Let me explain my understanding.
`isValidMetadataTable ` is only used for iceberg meta table, today we can
query iceberg meta table `snapshots `using **three layer namespace** like: `
dbName.tblName.snapshots`
https://github.com/apache/hive/blob/227db3df60152d84994a91dfae789edfd1450bd3/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergMetadataTables.java#L22-L26
` isTableIdentifierSupported` I added is a general term which indicate the
table can have **three layer namespace** , e.g meta table `
dbName.tblName.snapshots` and branch&tag ` dbName.tblName.branch_branchName`.
That is to say, i want to use `TableIdentifier` to mean the table support
**three layer namespace** before we distinguish between meta table and branch
using keyword `branch_`.
But maybe the term `TableIdentifier` can not express the meaning of **three
layer namespace** precisely. I want to you give some advice. Thanks in advance.
--
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]