[ 
https://issues.apache.org/jira/browse/HIVE-22209?focusedWorklogId=317727&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-317727
 ]

ASF GitHub Bot logged work on HIVE-22209:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Sep/19 17:58
            Start Date: 24/Sep/19 17:58
    Worklog Time Spent: 10m 
      Work Description: scarlin-cloudera commented on 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 317727)
    Time Spent: 1.5h  (was: 1h 20m)

> Creating a materialized view with no tables should be handled more gracefully
> -----------------------------------------------------------------------------
>
>                 Key: HIVE-22209
>                 URL: https://issues.apache.org/jira/browse/HIVE-22209
>             Project: Hive
>          Issue Type: Bug
>          Components: Materialized views
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Steve Carlin
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: HIVE-22209.1.patch, HIVE-22209.patch
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently, materialized views without a table reference are not supported. 
> However, instead of printing a clear message about it, when a materialized 
> view is created without a table reference, we fail with an unclear message.
> {code}
> > create materialized view mv_test1 as select 5;
> (...)
> ERROR : FAILED: Execution Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Add request 
> failed :
> INSERT INTO MV_TABLES_USED (MV_CREATION_METADATA_ID,TBL_ID) VALUES (?,?) )
> INFO : Completed executing 
> command(queryId=hive_20190916203511_b609cccf-f5e3-45dd-abfd-6e869d94e39a); 
> Time taken: 10.469 seconds
> Error: Error while processing statement: FAILED: Execution Error, return code 
> 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaExcep
> tion(message:Add request failed : INSERT INTO MV_TABLES_USED 
> (MV_CREATION_METADATA_ID,TBL_ID) VALUES (?,?) ) (state=08S01,code=1)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to