kasakrisz commented on code in PR #4837:
URL: https://github.com/apache/hive/pull/4837#discussion_r1384617494
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/DDLPlanUtils.java:
##########
@@ -691,20 +691,26 @@ public void
getAlterTableStmtForeignKeyConstraint(ForeignKeyInfo fr, List<String
}
Map<String, List<ForeignKeyInfo.ForeignKeyCol>> all = fr.getForeignKeys();
for (String key : all.keySet()) {
- for (ForeignKeyInfo.ForeignKeyCol fkc : all.get(key)) {
- ST command = new ST(ALTER_TABLE_ADD_FOREIGN_KEY);
- command.add(CHILD_TABLE_NAME, fr.getChildTableName());
- command.add(DATABASE_NAME, fr.getChildDatabaseName());
- command.add(CONSTRAINT_NAME, key);
- command.add(CHILD_COL_NAME, fkc.childColName);
- command.add(DATABASE_NAME_FR, fkc.parentDatabaseName);
- command.add(PARENT_TABLE_NAME, fkc.parentTableName);
- command.add(PARENT_COL_NAME, fkc.parentColName);
- command.add(ENABLE, fkc.enable);
- command.add(VALIDATE, fkc.validate);
- command.add(RELY, fkc.rely);
- constraints.add(command.render());
+ List<ForeignKeyInfo.ForeignKeyCol> fkCols = all.get(key);
+ List<String> parentCols = new ArrayList<>();
+ List<String> childCols = new ArrayList<>();
Review Comment:
How about using `LinkedHashSet<String>(fkCols.size())` since column names
should be unique.
--
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]