scarlin-cloudera commented on a change in pull request #2763:
URL: https://github.com/apache/hive/pull/2763#discussion_r747601749
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java
##########
@@ -333,12 +360,20 @@ public boolean isKey(ImmutableBitSet columns) {
parentTableQualifiedName.add(parentTableName);
qualifiedName = parentTableName;
}
+ if (!tablesCache.containsKey(qualifiedName)) {
+ // Table doesn't exist in the cache, so we don't need to track
+ // these referential constraints. But we do need to keep track
+ // of the table in case the tableCache gets populated later, though
+ // in theory, this should never happen based on how this is called.
Review comment:
Ok, in my most recent push, I created a hash map wrapper. This wrapper
allows the caller to mark the fact that all tables have been parsed.
The call for getting the referential constraints is now only allowed when
the table map is marked as parsed so we can be assured that the list of tables
used in the query is complete when fetching the referential constraints. I
think I did this with minimal intrusion on the original code, though some of
that still does need rewriting.
Thanks for the review comments and making me think about this a bit more!
--
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]