You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/09 15:29:08 UTC
[GitHub] [shardingsphere] everly-gif opened a new pull request, #16708: Support Parsing `DROP VIEW` in Oracle
everly-gif opened a new pull request, #16708:
URL: https://github.com/apache/shardingsphere/pull/16708
Refers #6480.
Changes proposed in this pull request:
- Supports parsing `DROP VIEW` in Oracle
- Adds Tests
- Corrects files
✅ Builds Locally
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] Liangda-w commented on a diff in pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
Liangda-w commented on code in PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#discussion_r846673340
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -43,6 +43,10 @@ dropIndex
: DROP INDEX indexName ONLINE? FORCE? ((DEFERRED|IMMEDIATE) INVALIDATION)?
;
+dropView
+ : DROP VIEW (schemaName DOT_)? viewName (CASCADE CONSTRAINTS)?
Review Comment:
`viewName` is defined in `BaseRule.g4` as the following
```
viewName
: (owner DOT_)? name
;
```
so you can leave out the `(schemaName DOT_)?` here
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleDropViewStatement.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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 lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle drop view statement.
+ */
+@ToString
+public final class OracleDropViewStatement extends AbstractSQLStatement implements DDLStatement, OracleStatement {
Review Comment:
`DropViewStatement.java` exists, so you can extend it directly
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on a diff in pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
everly-gif commented on code in PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#discussion_r846704982
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -43,6 +43,10 @@ dropIndex
: DROP INDEX indexName ONLINE? FORCE? ((DEFERRED|IMMEDIATE) INVALIDATION)?
;
+dropView
+ : DROP VIEW (schemaName DOT_)? viewName (CASCADE CONSTRAINTS)?
Review Comment:
Oh yes 👍, Made the changes.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] Liangda-w merged pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
Liangda-w merged PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1096283550
Hi @everly-gif, thank you for your great contribution. Can you submit a new pr to support create view and alter view statements?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
everly-gif commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1098895192
The `create view` [doc](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-VIEW.html#GUID-61D2D2B4-DACC-4C7C-89EB-7E50D9594D30) grammar is very complex. However I have tried to define the grammar and the antlr4 plugin **throws no error**. But the `shardingsphere-sql-parser-dialect` module has test failures. The only error I receive is` there is an error in your SQL syntax`. So I haven't been able to debug much.
Here's the grammar I wrote,
In DDLStatement.g4
```
createView
: CREATE (OR REPLACE)? ((NO)? FORCE)? ( EDITIONING | EDITIONABLE (EDITIONING)? | NONEDITIONABLE)? VIEW viewName
createSharingClause ( LP_ (aliasClause (COMMA_ aliasClause)* | outOfLineConstraint) RP_ | createObjectViewClause |
createXMLTypeViewClause)? (DEFAULT COLLATION collationName)? (BEQUEATH (CURRENT_USER | DEFINER))? AS subquery
(subqueryRestrictionClause)? (CONTAINER_MAP | CONTAINERS_DEFAULT)?
;
createObjectViewClause
: OF objectName (
| WITH OBJECT (IDENTIFIER | ID) (
| DEFAULT
| attributeNames )
| UNDER superViewName )
( LP_ ( outOfLineConstraint (COMMA_ outOfLineConstraint)* | attributeName inlineConstraint* ) RP_ )?
;
createXMLTypeViewClause
: OF XMLTYPE xmlSchemaSpecClause? WITH OBJECT (IDENTIFIER | ID) (DEFAULT | expressionList)
;
aliasClause
: (VISIBILE | INVISIBLE)? (inlineConstraint*)?
;
subqueryRestrictionClause
: WITH (
| READ ONLY
| CHECK OPTION
) (CONSTRAINT constraintName)?
;
```
In OracleKeyword.g4
```
EDITIONING
: E D I T I O N I N G
;
ID
: I D
;
BEQUEATH
: B E Q U E A T H
;
```
In Baserule.g4
```
superViewName
: (owner DOT_)? name
;
attributeNames
: LP_ attributeName (COMMA_ attributeName)* RP_
;
```
Can you please guide me with what is the issue here.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
everly-gif commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1098895193
The `create view` [doc](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-VIEW.html#GUID-61D2D2B4-DACC-4C7C-89EB-7E50D9594D30) grammar is very complex. However I have tried to define the grammar and the antlr4 plugin **throws no error**. But the `shardingsphere-sql-parser-dialect` module has test failures. The only error I receive is` there is an error in your SQL syntax`. So I haven't been able to debug much.
Here's the grammar I wrote,
In DDLStatement.g4
```
createView
: CREATE (OR REPLACE)? ((NO)? FORCE)? ( EDITIONING | EDITIONABLE (EDITIONING)? | NONEDITIONABLE)? VIEW viewName
createSharingClause ( LP_ (aliasClause (COMMA_ aliasClause)* | outOfLineConstraint) RP_ | createObjectViewClause |
createXMLTypeViewClause)? (DEFAULT COLLATION collationName)? (BEQUEATH (CURRENT_USER | DEFINER))? AS subquery
(subqueryRestrictionClause)? (CONTAINER_MAP | CONTAINERS_DEFAULT)?
;
createObjectViewClause
: OF objectName (
| WITH OBJECT (IDENTIFIER | ID) (
| DEFAULT
| attributeNames )
| UNDER superViewName )
( LP_ ( outOfLineConstraint (COMMA_ outOfLineConstraint)* | attributeName inlineConstraint* ) RP_ )?
;
createXMLTypeViewClause
: OF XMLTYPE xmlSchemaSpecClause? WITH OBJECT (IDENTIFIER | ID) (DEFAULT | expressionList)
;
aliasClause
: (VISIBILE | INVISIBLE)? (inlineConstraint*)?
;
subqueryRestrictionClause
: WITH (
| READ ONLY
| CHECK OPTION
) (CONSTRAINT constraintName)?
;
```
In OracleKeyword.g4
```
EDITIONING
: E D I T I O N I N G
;
ID
: I D
;
BEQUEATH
: B E Q U E A T H
;
```
In Baserule.g4
```
superViewName
: (owner DOT_)? name
;
attributeNames
: LP_ attributeName (COMMA_ attributeName)* RP_
;
```
Can you please guide me with what is the issue here.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on a diff in pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
everly-gif commented on code in PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#discussion_r846704896
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleDropViewStatement.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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 lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle drop view statement.
+ */
+@ToString
+public final class OracleDropViewStatement extends AbstractSQLStatement implements DDLStatement, OracleStatement {
Review Comment:
Okay, have made the changes
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] everly-gif commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
everly-gif commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1096487639
@strongduanmu Sure ! You should soon see two PRs from me :)
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1094135494
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#16708](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (de4f551) into [master](https://codecov.io/gh/apache/shardingsphere/commit/2ff3dd9738e8035e4aa45cb590f7c4dd5f4c251a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2ff3dd9) will **increase** coverage by `0.00%`.
> The diff coverage is `50.00%`.
```diff
@@ Coverage Diff @@
## master #16708 +/- ##
=========================================
Coverage 60.57% 60.57%
Complexity 2112 2112
=========================================
Files 3378 3379 +1
Lines 50798 50800 +2
Branches 8721 8721
=========================================
+ Hits 30769 30773 +4
+ Misses 17438 17436 -2
Partials 2591 2591
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../statement/oracle/ddl/OracleDropViewStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/16708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9zdGF0ZW1lbnQvb3JhY2xlL2RkbC9PcmFjbGVEcm9wVmlld1N0YXRlbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...omain/statement/ddl/DropViewStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/16708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2RkbC9Ecm9wVmlld1N0YXRlbWVudFRlc3RDYXNlLmphdmE=) | `100.00% <ø> (ø)` | |
| [...r/statement/impl/OracleDDLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/16708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRERMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `86.17% <100.00%> (+0.05%)` | :arrow_up: |
| [...d/text/distsql/ral/common/hint/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/16708/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9oaW50L0hpbnRTb3VyY2VUeXBlLmphdmE=) | `42.85% <0.00%> (+42.85%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [2ff3dd9...de4f551](https://codecov.io/gh/apache/shardingsphere/pull/16708?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on pull request #16708: Support Parsing `DROP VIEW` in Oracle
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on PR #16708:
URL: https://github.com/apache/shardingsphere/pull/16708#issuecomment-1096588841
> @strongduanmu Sure ! You should soon see two PRs from me :) Also do you want me to do it for Oracle or PostgreSQL? I'm assuming Oracle.
@everly-gif Yes, it's Oracle database. You can try to support Oracle view statements parse first, and then refer pr #16771 to adapt Oracle views so that they can execute normally.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org