jcamachor commented on a change in pull request #782: HIVE-22209: Graceful 
error msg when there is no table for a materiali…
URL: https://github.com/apache/hive/pull/782#discussion_r327417741
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java
 ##########
 @@ -456,4 +456,22 @@ public boolean containsQueryWithoutSourceTable() {
     }
     return aliasToTabs.size()==0 && aliasToSubq.size()==0;
   }
+
+  // returns false when the query block doesn't have
+  // a table defined, e.g. "select 5"
+  public boolean hasTableDefined() {
+    // A table is not defined when there only exists a dummy
+    // table in the alias, so if it is blank, we know a table
+    // is defined.
+    if (aliasToTabs.size() == 0) {
+      return true;
+    }
+    for (String alias : aliasToTabs.keySet()) {
 
 Review comment:
   Shouldn't we iterate through `tableAliases` as we do above the call to 
`hasTableDefined`?

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