Support parsing Oracle CREATE OR sql
Background
Hi community, This issue is for #26878.
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 Oracle SQL parsing in ShardingSphere.
More details: https://shardingsphere.apache.org/document/current/en/reference/sharding/parse/
Task
This issue is to support more oracle sql parse, as follows:
CREATE OR REPLACE VIEW sales_view_ref AS
SELECT country_name country,
prod_name prod,
calendar_year year,
SUM(amount_sold) sale,
COUNT(amount_sold) cnt
FROM sales,times,customers,countries,products
WHERE sales.time_id = times.time_id
AND sales.prod_id = products.prod_id
AND sales.cust_id = customers.cust_id
AND customers.country_id = countries.country_id
AND ( customers.country_id = 52779
OR customers.country_id = 52776 )
AND ( prod_name = 'Standard Mouse'
OR prod_name = 'Mouse Pad' )
GROUP BY country_name,prod_name,calendar_year;
SELECT country, prod, year, sale
FROM sales_view_ref
ORDER BY country, prod, year;
CREATE PROFILE new_profile
LIMIT PASSWORD_REUSE_MAX 10
PASSWORD_REUSE_TIME 30;
CREATE PROFILE clerk LIMIT
SESSIONS_PER_USER 1
IDLE_TIME 30
CONNECT_TIME 600;
CREATE USER jfee
IDENTIFIED BY password
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp_ts
QUOTA 500K ON users
PROFILE clerk;
CREATE USER dcranney
IDENTIFIED BY password
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp_ts
QUOTA unlimited ON users;
CREATE USER userscott
IDENTIFIED BY password;
CREATE PROFILE prof LIMIT
FAILED_LOGIN_ATTEMPTS 10
PASSWORD_LOCK_TIME 30;
ALTER USER johndoe PROFILE prof;
CREATE PROFILE app_user2 LIMIT
FAILED_LOGIN_ATTEMPTS 5
PASSWORD_LIFE_TIME 60
PASSWORD_REUSE_TIME 60
PASSWORD_REUSE_MAX 5
PASSWORD_VERIFY_FUNCTION verify_function
PASSWORD_LOCK_TIME 1/24
PASSWORD_GRACE_TIME 10;
Process
- First confirm that this is a correct oracle sql syntax, if not please ignore;
- Compare SQL definitions in Oficial SQL Doc and ShardingSphere SQL Doc;
- If there is any difference in ShardingSphere SQL Doc, please correct them by referring to the Official SQL Doc;
- Run mvn install the current_file_module;
- Check whether there are any exceptions. If indeed, please fix them. (Especially xxxVisitor.class);
- Add new corresponding SQL case in SQL Cases and expected parsed result in Expected Statment XML;
- Run SQLParserParameterizedTest to make sure no exceptions.
Relevant Skills
- Master JAVA language
- Have a basic understanding of Antlr
g4file - Be familiar with Oracle SQLs
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Hi, is there anyone in the community currently working on this issue?
Hi, is there anyone in the community currently working on this issue?
No, do you want to finish this task?
Hi, is there anyone in the community currently working on this issue?
No, do you want to finish this task?
I think this pr: https://github.com/apache/shardingsphere/pull/28432 has finished the task.
Hi, is there anyone in the community currently working on this issue?
No, do you want to finish this task?
I think this pr: #28432 has finished the task.
Can you test these sqls? If all sqls have been supported, I will close this issue.
Hi, is there anyone in the community currently working on this issue?
No, do you want to finish this task?
I think this pr: #28432 has finished the task.
Can you test these sqls? If all sqls have been supported, I will close this issue.
Not all SQLs are supported, I only tested the sql of create view as I need it.
If you are interested, you can try to finish this issue. @lancelly
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Hello @strongduanmu these oracle queries are being parsed correctly
Example : CREATE PROFILE app_user2 LIMIT FAILED_LOGIN_ATTEMPTS 5 PASSWORD_LIFE_TIME 60 PASSWORD_REUSE_TIME 60 PASSWORD_REUSE_MAX 5 PASSWORD_VERIFY_FUNCTION verify_function PASSWORD_LOCK_TIME 1/24 PASSWORD_GRACE_TIME 10;
Also I will add these test cases to tests -> it -> parsers -> resources -> sql. for Oracle SQL
Could you please assign me with this issue.
Hello @strongduanmu these oracle queries are being parsed correctly
Example : CREATE PROFILE app_user2 LIMIT FAILED_LOGIN_ATTEMPTS 5 PASSWORD_LIFE_TIME 60 PASSWORD_REUSE_TIME 60 PASSWORD_REUSE_MAX 5 PASSWORD_VERIFY_FUNCTION verify_function PASSWORD_LOCK_TIME 1/24 PASSWORD_GRACE_TIME 10;
Also I will add these test cases to tests -> it -> parsers -> resources -> sql. for Oracle SQL
Could you please assign me with this issue
