Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-7079

Hive logs errors about missing tables when parsing CTE expressions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.13.0
    • Fix Version/s: 0.14.0
    • Component/s: Query Processor
    • Labels:
      None

      Description

      Given a query containing common table expressions (CTE) such as:

      WITH a AS (SELECT ...), b AS (SELECT ...)
      SELECT * FROM a JOIN b on a.col = b.col ...;

      Hive CLI executes the query, but logs stack traces at ERROR level during query parsing:

      ERROR metadata.Hive: NoSuchObjectException(message:ccondit.a table not found)
      	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$get_table_result$get_table_resultStandardScheme.read(ThriftHiveMetastore.java:29338)
      	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$get_table_result$get_table_resultStandardScheme.read(ThriftHiveMetastore.java:29306)
      	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$get_table_result.read(ThriftHiveMetastore.java:29237)
      	at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
      	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_get_table(ThriftHiveMetastore.java:1036)
      	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.get_table(ThriftHiveMetastore.java:1022)
      	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getTable(HiveMetaStoreClient.java:997)
      	at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:89)
      	at com.sun.proxy.$Proxy7.getTable(Unknown Source)
      	at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:967)
      	at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:909)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1223)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getMetaData(SemanticAnalyzer.java:1192)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:9209)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:327)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:391)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:291)
      	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:944)
      	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1009)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:880)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:870)
      	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:268)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:220)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:423)
      	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:792)
      	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:686)
      	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
      

      It looks like Hive is attempting to resolve the CTE aliases as physical tables.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                navis Navis
                Reporter:
                ccondit Craig Condit
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: