FlyingZC opened a new issue, #27735: URL: https://github.com/apache/shardingsphere/issues/27735
# Background Hi community, ShardingSphere parser engine helps users parse a SQL to get the AST (Abstract Syntax Tree) and visit this tree to get SQLStatement (Java Object). Currently, we are planning to enhance the support for openGauss SQL parsing in ShardingSphere. More details: https://shardingsphere.apache.org/document/current/en/reference/sharding/parse/ # Task This issue is to support more openGauss sql parse, as follows: ```sql db_ignore=# create table t_unique(num int unique); NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_unique_num_key" for table "t_unique" CREATE TABLE db_ignore=# insert into t_unique values(1); INSERT 0 1 db_ignore=# insert /*+ ignore_error */ into t_unique values(1),(2); WARNING: duplicate key value violates unique constraint in table "t_unique" INSERT 0 1 db_ignore=# select * from t_unique; ``` ```sql db_ignore=# CREATE TABLE t_ignore db_ignore-# ( db_ignore(# col1 integer NOT NULL, db_ignore(# col2 character varying(60) db_ignore(# ) WITH(segment = on) PARTITION BY RANGE (col1) db_ignore-# ( db_ignore(# PARTITION P1 VALUES LESS THAN(5000), db_ignore(# PARTITION P2 VALUES LESS THAN(10000), db_ignore(# PARTITION P3 VALUES LESS THAN(15000) db_ignore(# ); CREATE TABLE db_ignore=# insert /*+ ignore_error */ into t_ignore values(20000); WARNING: inserted partition key does not map to any table partition INSERT 0 0 db_ignore=# select * from t_ignore ; ``` ```sql -- 当新值类型与列类型同为数值类型 db_ignore=# create table t_tinyint(num tinyint); CREATE TABLE db_ignore=# insert /*+ ignore_error */ into t_tinyint values(10000); WARNING: tinyint out of range CONTEXT: referenced column: num INSERT 0 1 db_ignore=# select * from t_tinyint; num ----- 127 (1 row) -- 当新值类型与列类型同为字符类型时 db_ignore=# create table t_varchar5(content varchar(5)); CREATE TABLE db_ignore=# insert /*+ ignore_error */ into t_varchar5 values('abcdefghi'); WARNING: value too long for type character varying(5) CONTEXT: referenced column: content INSERT 0 1 db_ignore=# select * from t_varchar5 ; ``` ```sql insert into value_test values(); ERROR: null value in column "a" violates not-null constraint --关闭sql_mode,向表中插入VALUES()。 ``` ```sql insert into value_test values(); --查看表数据 ``` # Process 1. First confirm that this is a correct openGauss sql syntax, if not please leave a message under the issue and ignore it; 2. Compare SQL definitions in Official SQL Doc and ShardingSphere SQL Doc; 3. If there is any difference in ShardingSphere SQL Doc, please correct them by referring to the Official SQL Doc; 4. Run mvn install the current_file_module; 5. Check whether there are any exceptions. If indeed, please fix them. (Especially xxxVisitor.class); 6. Add new corresponding SQL case in SQL Cases and expected parsed result in Expected Statement XML; 7. Run SQLParserParameterizedTest to make sure no exceptions. # Relevant Skills 1. Master JAVA language 2. Have a basic understanding of Antlr `g4` file 3. Be familiar with openGauss SQLs -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
