You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Istvan Szegedi (JIRA)" <ji...@apache.org> on 2012/12/22 00:47:13 UTC

[jira] [Commented] (HIVE-3439) PARTITIONED BY clause in CREATE TABLE is order-dependent

    [ https://issues.apache.org/jira/browse/HIVE-3439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13538548#comment-13538548 ] 

Istvan Szegedi commented on HIVE-3439:
--------------------------------------

This is determined by Hive.g grammar file used for ANTLR parser - ./hive-trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g:

createTableStatement
@init { msgs.push("create table statement"); }
@after { msgs.pop(); }
    : KW_CREATE (ext=KW_EXTERNAL)? KW_TABLE ifNotExists? name=tableName
      (  like=KW_LIKE likeName=tableName
         tableLocation?
       | (LPAREN columnNameTypeList RPAREN)?
         tableComment?
         tablePartition?
         tableBuckets?
         tableSkewed?
         tableRowFormat?
         tableFileFormat?
         tableLocation?
         tablePropertiesPrefixed?
         (KW_AS selectStatement)?
      )
    -> ^(TOK_CREATETABLE $name $ext? ifNotExists?
         ^(TOK_LIKETABLE $likeName?)
         columnNameTypeList?
         tableComment?
         tablePartition?
         tableBuckets?
         tableSkewed?
         tableRowFormat?
         tableFileFormat?
         tableLocation?
         tablePropertiesPrefixed?
         selectStatement?
        )
    ;


The grammar determines the order for create table statement. And this is in-line with the DDL create table documentation:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable


In theory, it could be changed to something like:

( tablePartition? tableLocation?  | tableLocation? tablePartition?) 

but it does not really seem to be a bug.
                
> PARTITIONED BY clause in CREATE TABLE is order-dependent
> --------------------------------------------------------
>
>                 Key: HIVE-3439
>                 URL: https://issues.apache.org/jira/browse/HIVE-3439
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Jonathan Natkins
>
> hive> create external table foo (a int) location '/user/natty/foo' partitioned by (b int);
> FAILED: Parse Error: line 1:61 mismatched input 'partitioned' expecting EOF near ''/user/natty/foo''
> hive> create external table foo (a int) partitioned by (b int) location '/user/natty/foo';
> OK
> Time taken: 0.051 seconds

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira