kgyrtkirk commented on a change in pull request #550: HIVE-21198 Introduce a 
database object reference class
URL: https://github.com/apache/hive/pull/550#discussion_r345393971
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
 ##########
 @@ -1160,16 +1158,16 @@ protected static void processForeignKeys(String 
databaseName, String tableName,
         " The number of foreign key columns should be same as number of parent 
key columns "));
     }
 
-    String[] parentDBTbl = getQualifiedTableName((ASTNode) 
child.getChild(ptIndex));
+    final TableName parentTblName = getQualifiedTableName((ASTNode) 
child.getChild(ptIndex));
     for (int j = 0; j < child.getChild(fkIndex).getChildCount(); j++) {
       SQLForeignKey sqlForeignKey = new SQLForeignKey();
-      sqlForeignKey.setFktable_db(databaseName);
-      sqlForeignKey.setFktable_name(tableName);
+      sqlForeignKey.setFktable_db(tName.getDb());
+      sqlForeignKey.setFktable_name(tName.getTable());
       Tree fkgrandChild = child.getChild(fkIndex).getChild(j);
       checkColumnName(fkgrandChild.getText());
       
sqlForeignKey.setFkcolumn_name(unescapeIdentifier(fkgrandChild.getText().toLowerCase()));
-      sqlForeignKey.setPktable_db(parentDBTbl[0]);
-      sqlForeignKey.setPktable_name(parentDBTbl[1]);
+      sqlForeignKey.setPktable_db(parentTblName.getDb());
 
 Review comment:
   at some point we might want to consider changing the thrift as well?
   ....or we should leave that alone?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to