-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Support parsing Oracle CREATE MATERIALIZED sql (#27994)
* Feat: Support parsing Oracle CREATE MATERIALIZED sql * add final * refactor ddl g4 to inline grammer * refactor ddl and dml g4 * add back additional ddl g4 rules
- Loading branch information
1 parent
3cbd841
commit 2a8cc40
Showing
12 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...sql/parser/sql/dialect/statement/oracle/ddl/OracleCreateMaterializedViewLogStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl; | ||
|
||
import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement; | ||
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement; | ||
|
||
/** | ||
* Oracle create materialized view log statement. | ||
*/ | ||
public final class OracleCreateMaterializedViewLogStatement extends AbstractSQLStatement implements OracleStatement { | ||
} |
27 changes: 27 additions & 0 deletions
27
...re/sql/parser/sql/dialect/statement/oracle/ddl/OracleCreateMaterializedViewStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl; | ||
|
||
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateMaterializedViewStatement; | ||
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement; | ||
|
||
/** | ||
* OracleSQL create materialized view statement. | ||
*/ | ||
public final class OracleCreateMaterializedViewStatement extends CreateMaterializedViewStatement implements OracleStatement { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../internal/cases/parser/jaxb/statement/ddl/CreateMaterializedViewLogStatementTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl; | ||
|
||
import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase; | ||
|
||
/** | ||
* Create materialized view statement test case. | ||
*/ | ||
public final class CreateMaterializedViewLogStatementTestCase extends SQLParserTestCase { | ||
} |
26 changes: 26 additions & 0 deletions
26
test/it/parser/src/main/resources/case/ddl/create-materialized-view-log.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<sql-parser-test-cases> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with" /> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with_including_new" /> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with_tablespace" /> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with_table_schema" /> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with_object_id" /> | ||
<create-materialized-view-log sql-case-id="create_materialized_view_log_with_row_id" /> | ||
</sql-parser-test-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/it/parser/src/main/resources/sql/supported/ddl/create-materialized-view-log.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<sql-cases> | ||
<sql-case id="create_materialized_view_log_with" value="CREATE MATERIALIZED VIEW LOG ON inventories WITH (quantity_on_hand);" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_log_with_including_new" value="CREATE MATERIALIZED VIEW | ||
LOG ON employees WITH PRIMARY KEY INCLUDING NEW VALUES;" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_log_with_tablespace" value="CREATE MATERIALIZED VIEW | ||
LOG ON emp_data PCTFREE 5 PCTUSED 60 TABLESPACE example STORAGE (INITIAL 50K) | ||
REFRESH FAST NEXT sysdate + 7 AS SELECT * FROM employees;" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_log_with_table_schema" value="CREATE MATERIALIZED VIEW | ||
LOG ON "SH"."CUSTOMERS" WITH ROWID, SEQUENCE("CUST_ID") | ||
INCLUDING NEW VALUES;" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_log_with_object_id" value="CREATE MATERIALIZED VIEW LOG ON oe.categories_tab_sys WITH OBJECT ID;" db-types="Oracle" /> | ||
<sql-case id="create_materialized_view_log_with_row_id" value="CREATE MATERIALIZED VIEW LOG ON sales WITH ROWID;" db-types="Oracle" /> | ||
</sql-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters