scarlin-cloudera 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_r327715946
 
 

 ##########
 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) {
 
 Review comment:
   This seemed weird to me too, and perhaps I need a better solution.  I may be 
mistaken here, but I had tests fail when the table had no alias (e.g. 'select * 
from tbl1' as opposed to 'select * from tbl1 alias1').  However, when we had no 
table, there WAS an alias, and it was "DUMMY_TABLE";
   
   I didn't see any structure within QB containing all table names.  Is there 
another place you think I can grab it?

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