Skip to content

Commit

Permalink
Support oracle negative data type parsing (apache#27584)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingZC authored Jul 31, 2023
1 parent 8b7d97d commit 0e77df1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ alias
;

dataTypeLength
: LP_ (INTEGER_ (COMMA_ INTEGER_)? (CHAR | BYTE)?)? RP_
: LP_ (INTEGER_ (COMMA_ (MINUS_)? INTEGER_)? (CHAR | BYTE)?)? RP_
;

primaryKey
Expand Down
16 changes: 16 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 @@ -2005,4 +2005,20 @@
<primary-key-column name="order_id" start-index="163" stop-index="170" />
</constraint-definition>
</create-table>

<create-table sql-case-id="create_table_with_negative_data_type">
<table name="T" start-index="13" stop-index="13" literal-start-index="13" literal-stop-index="13" />
<column-definition type="NUMBER" start-index="15" stop-index="25">
<column name="COL1" />
</column-definition>
<column-definition type="NUMBER" start-index="28" stop-index="41">
<column name="COL2" />
</column-definition>
<column-definition type="NUMBER" start-index="44" stop-index="59">
<column name="COL3" />
</column-definition>
<column-definition type="NUMBER" start-index="62" stop-index="78">
<column name="COL4" />
</column-definition>
</create-table>
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,5 @@
<sql-case id="create_table_with_unsigned_int_cast_function" value="CREATE TABLE t1(j json, INDEX mv_idx((CAST(j AS UNSIGNED INT ARRAY))))" db-types="MySQL" />
<sql-case id="create_table_with_unsigned_int" value="CREATE TABLE t_order (order_id INT, user_id INT, status UNSIGNED INT)" db-types="MySQL" />
<sql-case id="create_table_with_partition_less_than" value="CREATE TABLE t_sales (order_id INTEGER NOT NULL, goods_name CHAR(20) NOT NULL, sales_date DATE NOT NULL, sales_volume INTEGER, sales_store CHAR(20), PRIMARY KEY ( order_id )) PARTITION BY RANGE (sales_date) (PARTITION season1 VALUES LESS THAN('2023-04-01 00:00:00'),PARTITION season2 VALUES LESS THAN('2023-07-01 00:00:00'),PARTITION season3 VALUES LESS THAN('2023-10-01 00:00:00'),PARTITION season4 VALUES LESS THAN(MAXVALUE))" db-types="openGauss"/>
<sql-case id="create_table_with_negative_data_type" value="CREATE TABLE T(COL1 NUMBER, COL2 NUMBER(3), COL3 NUMBER(3,2), COL4 NUMBER(6,-2))" db-types="Oracle" />
</sql-cases>

0 comments on commit 0e77df1

Please sign in to comment.