zhangbutao commented on code in PR #4292:
URL: https://github.com/apache/hive/pull/4292#discussion_r1208398073


##########
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:
   Better than `TableIdentifier`. :)  I changed `TableIdentifier `to 
`TableMetaRef`. Thanks.



-- 
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]

Reply via email to