Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: SQL Parser
    • Labels:
      None

      Description

      We can refer to Oracle, and MySQL. They have well-defined statements.

      1. TAJO-285.patch
        27 kB
        Hyunsik Choi

        Activity

        Hide
        hyunsik Hyunsik Choi added a comment -

        I've attached the first patch. This patch adds RANGE, LIST, HASH, and COLUMN partition options to CREATE TABLE statement. COLUMN partition type is for Hive-style partition.

        Each partition type's example is as follows:

        Hash Partition
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY HASH (col1)
        PARTITIONS 2;
        
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY HASH (col1)
        (
          PARTITION part1,
          PARTITION part2,
          PARTITION part3
        );
        
        Range Partition
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY RANGE (col1)
         (
          PARTITION col1 VALUES LESS THAN (2),
          PARTITION col1 VALUES LESS THAN (5),
          PARTITION col1 VALUES LESS THAN (MAXVALUE)
         );
        
        List Partition
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY LIST (col1)
         (
          PARTITION col1 VALUES ('Seoul', '서울'),
          PARTITION col2 VALUES ('Busan', '부산')
         );
        
        List Partition
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY LIST (col1)
         (
          PARTITION col1 VALUES ('Seoul', '서울'),
          PARTITION col2 VALUES ('Busan', '부산')
         );
        
        Column Partition (Hive Partition)
        CREATE TABLE sales ( col1 int, col2 int)
        PARTITION BY COLUMN (col1, col2, col3);
        
        Show
        hyunsik Hyunsik Choi added a comment - I've attached the first patch. This patch adds RANGE, LIST, HASH, and COLUMN partition options to CREATE TABLE statement. COLUMN partition type is for Hive-style partition. Each partition type's example is as follows: Hash Partition CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY HASH (col1) PARTITIONS 2; CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY HASH (col1) ( PARTITION part1, PARTITION part2, PARTITION part3 ); Range Partition CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY RANGE (col1) ( PARTITION col1 VALUES LESS THAN (2), PARTITION col1 VALUES LESS THAN (5), PARTITION col1 VALUES LESS THAN (MAXVALUE) ); List Partition CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY LIST (col1) ( PARTITION col1 VALUES ('Seoul', '서울'), PARTITION col2 VALUES ('Busan', '부산') ); List Partition CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY LIST (col1) ( PARTITION col1 VALUES ('Seoul', '서울'), PARTITION col2 VALUES ('Busan', '부산') ); Column Partition (Hive Partition) CREATE TABLE sales ( col1 int , col2 int ) PARTITION BY COLUMN (col1, col2, col3);
        Hide
        hyunsik Hyunsik Choi added a comment -

        In addition, this patch moves some reserved keywords to non-reserved keywords.

        Show
        hyunsik Hyunsik Choi added a comment - In addition, this patch moves some reserved keywords to non-reserved keywords.
        Hide
        jihoonson Jihoon Son added a comment -

        If there isn't anyone who wants to review, I'll review the patch tonight.

        Show
        jihoonson Jihoon Son added a comment - If there isn't anyone who wants to review, I'll review the patch tonight.
        Hide
        jihoonson Jihoon Son added a comment -

        +1
        This patch looks good to me to support PARTITION BY clause in the parser.

        Show
        jihoonson Jihoon Son added a comment - +1 This patch looks good to me to support PARTITION BY clause in the parser.
        Hide
        hyunsik Hyunsik Choi added a comment -

        committed it to the master. Thanks for the review.

        Show
        hyunsik Hyunsik Choi added a comment - committed it to the master. Thanks for the review.
        Hide
        jhkim Jinho Kim added a comment -

        Hyunsik,

        This patch includes some unicode.
        Could you add '-Dfile.encoding=UTF-8' in maven-surefire-plugin ?

        Thanks

        Show
        jhkim Jinho Kim added a comment - Hyunsik, This patch includes some unicode. Could you add '-Dfile.encoding=UTF-8' in maven-surefire-plugin ? Thanks
        Hide
        hyunsik Hyunsik Choi added a comment -

        Thank you for your comment. I didn't consider the systems whose default encoding is not UTF-8. Since this is a trivial change, I'll just do the fix commit.

        Show
        hyunsik Hyunsik Choi added a comment - Thank you for your comment. I didn't consider the systems whose default encoding is not UTF-8. Since this is a trivial change, I'll just do the fix commit.
        Hide
        hyunsik Hyunsik Choi added a comment -

        I've committed the fix. Thank you, Jinho!

        Show
        hyunsik Hyunsik Choi added a comment - I've committed the fix. Thank you, Jinho!
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-trunk-postcommit #544 (See https://builds.apache.org/job/Tajo-trunk-postcommit/544/)
        TAJO-285: Add CREATE TABLE... BY PARTITION statement to parser. (hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=06b1e0e70c52c17b68a2cd726985149d5430bd78)

        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
        • tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
        • tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql
        • tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4
        • tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
        • tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql
        • tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java
        • tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql
        • CHANGES.txt
        • tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql
          TAJO-285: Add CREATE TABLE... BY PARTITION statement to parser. (Fixed file encoding problem) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=2186e63b13ecde617cf79e408a13740755637822)
        • tajo-core/tajo-core-backend/pom.xml
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-trunk-postcommit #544 (See https://builds.apache.org/job/Tajo-trunk-postcommit/544/ ) TAJO-285 : Add CREATE TABLE... BY PARTITION statement to parser. (hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=06b1e0e70c52c17b68a2cd726985149d5430bd78 ) tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4 tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLLexer.g4 tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql CHANGES.txt tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql TAJO-285 : Add CREATE TABLE... BY PARTITION statement to parser. (Fixed file encoding problem) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=2186e63b13ecde617cf79e408a13740755637822 ) tajo-core/tajo-core-backend/pom.xml

          People

          • Assignee:
            hyunsik Hyunsik Choi
            Reporter:
            hyunsik Hyunsik Choi
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development