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_r327755104
##########
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:
Actually, it's more than suspicious...I have a bug (was just thinking about
it)
Even if it is true that the size is 0 when there are no tables, there will
be a bug when there is one table that has one subquery that has no table.
So here's my proposal...put in an if check that returns false if there is
exactly one table defined, it is a DUMMY_TABLE, and it doesn't have any
subqueries (it looks like QB has that information). Does that sound good?
----------------------------------------------------------------
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]