Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,27 @@ place
;

partitionDefinitions
: LP_ partitionDefinition (COMMA_ partitionDefinition)* RP_
// DORIS CHANGED BEGIN
: LP_ partitionDefinitionItem (COMMA_ partitionDefinitionItem)* RP_
;

partitionDefinitionItem
: partitionDefinition | dorisMultiRangePartition
;

dorisMultiRangePartition
: FROM LP_ expr RP_ TO LP_ expr RP_ INTERVAL expr intervalUnit?
;
// DORIS CHANGED END

partitionDefinition
// DORIS CHANGED BEGIN
: PARTITION partitionName
(VALUES (LESS THAN partitionLessThanValue | IN LP_ partitionValueList RP_))?
(VALUES (LESS THAN partitionLessThanValue | IN LP_ partitionValueList RP_ | LBT_ LP_ partitionValueList RP_ COMMA_ LP_ partitionValueList RP_ RP_))?
partitionDefinitionOption*
(LP_ properties RP_)?
(LP_ subpartitionDefinition (COMMA_ subpartitionDefinition)* RP_)?
// DORIS CHANGED END
;

partitionLessThanValue
Expand Down
52 changes: 52 additions & 0 deletions test/it/parser/src/main/resources/case/ddl/create-table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,58 @@
</column-definition>
</create-table>

<create-table sql-case-id="create_table_partition_with_storage_policy_doris" db-types="Doris">
<table name="create_table_partion_use_created_policy" start-index="13" stop-index="51" />
<column-definition type="DATE" start-index="54" stop-index="60">
<column name="k1" start-index="54" stop-index="55" />
</column-definition>
<column-definition type="INT" start-index="63" stop-index="68">
<column name="k2" start-index="63" stop-index="64" />
</column-definition>
<column-definition type="VARCHAR" agg-type="REPLACE" start-index="71" stop-index="94">
<column name="V1" start-index="71" stop-index="72" />
</column-definition>
</create-table>

<create-table sql-case-id="create_table_multi_range_partition_date_doris" db-types="Doris">
<table name="create_table_multi_partion_date" start-index="13" stop-index="43" />
<column-definition type="DATE" start-index="46" stop-index="52">
<column name="k1" start-index="46" stop-index="47" />
</column-definition>
<column-definition type="INT" start-index="55" stop-index="60">
<column name="k2" start-index="55" stop-index="56" />
</column-definition>
<column-definition type="VARCHAR" start-index="63" stop-index="76">
<column name="V1" start-index="63" stop-index="64" />
</column-definition>
</create-table>

<create-table sql-case-id="create_table_multi_range_partition_hour_doris" db-types="Doris">
<table name="create_table_multi_partion_date_hour" start-index="13" stop-index="48" />
<column-definition type="DATETIME" start-index="51" stop-index="61">
<column name="k1" start-index="51" stop-index="52" />
</column-definition>
<column-definition type="INT" start-index="64" stop-index="69">
<column name="k2" start-index="64" stop-index="65" />
</column-definition>
<column-definition type="VARCHAR" start-index="72" stop-index="85">
<column name="V1" start-index="72" stop-index="73" />
</column-definition>
</create-table>

<create-table sql-case-id="create_table_multi_range_partition_integer_doris" db-types="Doris">
<table name="create_table_multi_partion_integer" start-index="13" stop-index="46" />
<column-definition type="BIGINT" start-index="49" stop-index="57">
<column name="k1" start-index="49" stop-index="50" />
</column-definition>
<column-definition type="INT" start-index="60" stop-index="65">
<column name="k2" start-index="60" stop-index="61" />
</column-definition>
<column-definition type="VARCHAR" start-index="68" stop-index="81">
<column name="V1" start-index="68" stop-index="69" />
</column-definition>
</create-table>

<create-table sql-case-id="create_table_with_select_without_query" db-types="Oracle">
<table name="t_order_new" start-index="13" stop-index="23"/>
</create-table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
<sql-case id="create_table_with_unique_constraint_doris" value="CREATE TABLE t_unique (id INT, UNIQUE (id))" db-types="Doris" />
<sql-case id="create_table_with_foreign_key_constraint_doris" value="CREATE TABLE t_fk (id INT, CONSTRAINT fk_order FOREIGN KEY (id) REFERENCES ref_table (id))" db-types="Doris" />
<sql-case id="create_table_with_inline_reference_doris" value="CREATE TABLE t_col_fk (id INT REFERENCES ref_table(id))" db-types="Doris" />
<sql-case id="create_table_partition_with_storage_policy_doris" value="CREATE TABLE create_table_partion_use_created_policy (k1 DATE, k2 INT, V1 VARCHAR(2048) REPLACE) PARTITION BY RANGE (k1) (PARTITION p1 VALUES LESS THAN ('2022-01-01') ('storage_policy' = 'test_create_table_partition_use_policy_1', 'replication_num'='1'), PARTITION p2 VALUES LESS THAN ('2022-02-01') ('storage_policy' = 'test_create_table_partition_use_policy_2', 'replication_num'='1')) DISTRIBUTED BY HASH(k2) BUCKETS 1" db-types="Doris" />
<sql-case id="create_table_multi_range_partition_date_doris" value="CREATE TABLE create_table_multi_partion_date (k1 DATE, k2 INT, V1 VARCHAR(20)) PARTITION BY RANGE (k1) (FROM ('2000-11-14') TO ('2021-11-14') INTERVAL 1 YEAR, FROM ('2021-11-14') TO ('2022-11-14') INTERVAL 1 MONTH, FROM ('2022-11-14') TO ('2023-01-03') INTERVAL 1 WEEK, FROM ('2023-01-03') TO ('2023-01-14') INTERVAL 1 DAY, PARTITION p_20230114 VALUES [('2023-01-14'), ('2023-01-15'))) DISTRIBUTED BY HASH(k2) BUCKETS 1 PROPERTIES('replication_num' = '1')" db-types="Doris" />
<sql-case id="create_table_multi_range_partition_hour_doris" value="CREATE TABLE create_table_multi_partion_date_hour (k1 DATETIME, k2 INT, V1 VARCHAR(20)) PARTITION BY RANGE (k1) (FROM ('2023-01-03 12') TO ('2023-01-14 22') INTERVAL 1 HOUR) DISTRIBUTED BY HASH(k2) BUCKETS 1 PROPERTIES('replication_num' = '1')" db-types="Doris" />
<sql-case id="create_table_multi_range_partition_integer_doris" value="CREATE TABLE create_table_multi_partion_integer (k1 BIGINT, k2 INT, V1 VARCHAR(20)) PARTITION BY RANGE (k1) (FROM (1) TO (100) INTERVAL 10) DISTRIBUTED BY HASH(k2) BUCKETS 1 PROPERTIES('replication_num' = '1')" db-types="Doris" />
<sql-case id="create_table_with_select_without_query" value="CREATE TABLE t_order_new AS SELECT * FROM t_order" db-types="Oracle"/>
<sql-case id="create_table_as_select_with_pivot" value="CREATE TABLE pivot_table AS SELECT * FROM (SELECT EXTRACT(YEAR FROM order_date) year, order_mode, order_total FROM orders) PIVOT (SUM(order_total) FOR order_mode IN ('direct' AS Store, 'online' AS Internet));" db-types="Oracle"/>
<sql-case id="create_table_organization_index_parallel_with_select" value="CREATE TABLE admin_iot3(i PRIMARY KEY, j, k, l) ORGANIZATION INDEX PARALLEL AS SELECT * FROM hr.jobs" db-types="Oracle" />
Expand Down
Loading