You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ryan Harris <Ry...@zionsbancorp.com> on 2015/06/26 22:08:10 UTC

Change in Abstract Syntax Tree output format with EXPLAIN EXTENDED in 0.13

In hive 0.12, the Abstract Syntax Tree output format when using "EXPLAIN EXTENDED" matched what is in the wiki: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Explain

As an example, consider the following EXPLAIN query:
EXPLAIN
FROM src INSERT OVERWRITE TABLE dest_g1 SELECT src.key, sum(substr(src.value,4)) GROUP BY src.key;

The output of this statement contains the following parts:

    The Abstract Syntax Tree
    ABSTRACT SYNTAX TREE:
      (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_TAB dest_g1)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF src key)) (TOK_SELEXPR (TOK_FUNCTION sum (TOK_FUNCTION substr (TOK_COLREF src value) 4)))) (TOK_GROUPBY (TOK_COLREF src key))))

Starting with Hive 0.13 the structure of the Abstract Syntax Tree changed, and example is shown in jira HIVE-9483: https://issues.apache.org/jira/browse/HIVE-9483

hive> explain extended insert into foo values(1,2,3);
OK
ABSTRACT SYNTAX TREE:

TOK_QUERY
   TOK_FROM
      null
         null
            Values__Tmp__Table__13
   TOK_INSERT
      TOK_INSERT_INTO
         TOK_TAB
            TOK_TABNAME
               foo
      TOK_SELECT
         TOK_SELEXPR
            TOK_ALLCOLREF

I'm not sure of the reason for the change, but it is rather inconvenient.  Is there a way to get Hive 0.13+ to output an AST that matches the format of Hive<=0.12 ?

If the Hive 0.13+ output format is intended to be the standard moving forward, the wiki should probably be updated to reflect that.


Thanks.

======================================================================
THIS ELECTRONIC MESSAGE, INCLUDING ANY ACCOMPANYING DOCUMENTS, IS CONFIDENTIAL and may contain information that is privileged and exempt from disclosure under applicable law. If you are neither the intended recipient nor responsible for delivering the message to the intended recipient, please note that any dissemination, distribution, copying or the taking of any action in reliance upon the message is strictly prohibited. If you have received this communication in error, please notify the sender immediately.  Thank you.