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 2021/05/30 16:18:21 UTC

[GitHub] [shardingsphere] ThanoshanMV opened a new pull request #10558: Add with clause for Oracle `SELECT` statement

ThanoshanMV opened a new pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558


   #10111
   
   Hi @tristaZero, @wgy8283335. I've added SQL definition for [SELECT](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6) statement's with clause. Please check it. I'll change them based on your feedback.
   
   Changes proposed in this pull request:
   - Added SQL definition for `SELECT` statement's with clause.
   - Added test cases for with clause.
   - I asserted subquery in the `WithClauseAssert`.
   - In the `SQLServerDMLStatementSQLVisitor`, I changed the `SubquerySegment`'s start and stop indices by getting from `cteClauses()`'s `subquery()`.
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645215923



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       ![image](https://user-images.githubusercontent.com/22066046/120728991-a72fac00-c510-11eb-9b2b-b555d908fa17.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645908638



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/SelectStatement.java
##########
@@ -50,6 +51,8 @@
     
     private OrderBySegment orderBy;
     
+    private WithSegment withSegment;

Review comment:
       Why not add this to OracleSelectStatement?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r646068111



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/SelectStatement.java
##########
@@ -50,6 +51,8 @@
     
     private OrderBySegment orderBy;
     
+    private WithSegment withSegment;

Review comment:
       I think so.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r647035177



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       Because the definition of the predicate is different from the definition of the expr.
   ```
   predicate
       : bitExpr NOT? IN subquery
       | bitExpr NOT? IN LP_ expr (COMMA_ expr)* RP_
       | bitExpr NOT? BETWEEN bitExpr AND predicate
       | bitExpr NOT? LIKE simpleExpr (ESCAPE simpleExpr)?
       | bitExpr
       ;
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644400108



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `fromClause` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567572-b9441880-c444-11eb-9c0b-77507c3b08d9.png)
   
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645208541



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       I agree with you.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851024659


   I'll resolve merge conflicts.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645699406



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause
+    : measName AS LP_ calcMeasExpression RP_
+    ;
+
+calcMeasExpression
+    : avExpression | expr
+    ;
+
+avExpression
+    : avMeasExpression | avHierExpression
+    ;
+
+avMeasExpression
+    : leadLagExpression | windowExpression | rankExpression | shareOfExpression | qdrExpression
+    ;
+
+leadLagExpression
+    : leadLagFunctionName LP_ calcMeasExpression RP_ OVER LP_ leadLagClause RP_
+    ;
+
+leadLagFunctionName
+    : LAG | LAG_DIFF | LAG_DIF_PERCENT | LEAD | LEAD_DIFF | LEAD_DIFF_PERCENT
+    ;
+
+leadLagClause
+    : HIERARCHY hierarchyRef OFFSET offsetExpr ((WITHIN (LEVEL | PARENT)) | (ACROSS ANCESTOR AT LEVEL levelRef (POSITION FROM (BEGINNING | END))?))?
+    ;
+
+hierarchyRef
+    : (alias DOT_)? alias
+    ;
+

Review comment:
       I've put it.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645956629



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDMLStatementSQLVisitor.java
##########
@@ -243,7 +243,7 @@ public ASTNode visitWithClause(final WithClauseContext ctx) {
         List<CteClauseContext> cteClauses = ctx.cteClause();
         Collection<CommonTableExpressionSegment> commonTableExpressions = new LinkedList<>();
         for (CteClauseContext cte : cteClauses) {
-            SubquerySegment subquery = new SubquerySegment(cte.start.getStartIndex(), cte.stop.getStopIndex(), (SQLServerSelectStatement) visit(cte.subquery()));
+            SubquerySegment subquery = new SubquerySegment(cte.subquery().start.getStartIndex(), cte.subquery().stop.getStopIndex(), (SQLServerSelectStatement) visit(cte.subquery()));

Review comment:
       While I was adding start and stop indices for all `subquery-expression` within `common-table-expression`, in the SQLServer visitor, the `SubquerySegment`'s start and stop indices are collected from `CommonTableExpressionSegment`'s start and stop indices. So I changed them from getting `CommonTableExpressionSegment`'s `SubquerySegment`. Shall I remove this modification?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero merged pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645908784



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/delete.xml
##########
@@ -366,7 +366,7 @@
                     <column name="order_id" start-index="10" stop-index="17"/>
                     <column name="user_id" start-index="20" stop-index="26"/>
                 </columns>
-                <subquery-expression>
+                <subquery-expression start-index="32" stop-index="70">

Review comment:
       Why do you modify delete.xml ?

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/insert.xml
##########
@@ -1360,7 +1360,7 @@
                     <column name="order_id" start-index="10" stop-index="17"/>
                     <column name="user_id" start-index="20" stop-index="26"/>
                 </columns>
-                <subquery-expression>
+                <subquery-expression start-index="32" stop-index="70">

Review comment:
       Why do you modify delete.xml ?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645960140



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/dml/select-with.xml
##########
@@ -0,0 +1,22 @@
+<?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="select_with_subquery_factoring" value="WITH dept_costs AS (SELECT department_name, SUM(salary) dept_total FROM departments d GROUP BY department_name) SELECT * FROM dept_costs WHERE dept_total > 304500 ORDER BY department_name" db-types="Oracle"/>

Review comment:
       I'll add them.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645955068



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/delete.xml
##########
@@ -366,7 +366,7 @@
                     <column name="order_id" start-index="10" stop-index="17"/>
                     <column name="user_id" start-index="20" stop-index="26"/>
                 </columns>
-                <subquery-expression>
+                <subquery-expression start-index="32" stop-index="70">

Review comment:
       Since I tried to assert the `SubquerySegment` of `CommonTableExpressionSegment` in `WithClauseAssert`, I needed to provide start and stop indices for all `subquery-expression`s within `common-table-expression`s as it was asserted. 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r647035177



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       Because the definition of the predicate is different from the definition of the expr.
   ```
   predicate
       : bitExpr NOT? IN subquery
       | bitExpr NOT? IN LP_ expr (COMMA_ expr)* RP_
       | bitExpr NOT? BETWEEN bitExpr AND predicate
       | bitExpr NOT? LIKE simpleExpr (ESCAPE simpleExpr)?
       | bitExpr
       ;
   ``




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851099147


   I'd like to check this pr.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r646055738



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/SelectStatement.java
##########
@@ -50,6 +51,8 @@
     
     private OrderBySegment orderBy;
     
+    private WithSegment withSegment;

Review comment:
       @tristaZero Do you think we need to add `with clause` for  SQL Server, PostgreSQL, and MySQL?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter commented on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851029852


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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 [#10558](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (67a69f9) into [master](https://codecov.io/gh/apache/shardingsphere/commit/443daa0b62b8d7517162a9a6de173af171c5789a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (443daa0) will **decrease** coverage by `0.00%`.
   > The diff coverage is `57.14%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/10558/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #10558      +/-   ##
   ============================================
   - Coverage     68.60%   68.59%   -0.01%     
     Complexity      720      720              
   ============================================
     Files          1767     1767              
     Lines         30347    30367      +20     
     Branches       5439     5444       +5     
   ============================================
   + Hits          20820    20831      +11     
   - Misses         7919     7926       +7     
   - Partials       1608     1610       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rser/sql/common/statement/dml/SelectStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kbWwvU2VsZWN0U3RhdGVtZW50LmphdmE=) | `80.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [...ql/dialect/handler/dml/SelectStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9TZWxlY3RTdGF0ZW1lbnRIYW5kbGVyLmphdmE=) | `63.15% <0.00%> (-11.85%)` | :arrow_down: |
   | [...r/statement/impl/OracleDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `73.39% <68.75%> (-0.26%)` | :arrow_down: |
   | [...tatement/impl/SQLServerDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1zcWxzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvc3Fsc2VydmVyL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvU1FMU2VydmVyRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `86.79% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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/10558?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 [443daa0...67a69f9](https://codecov.io/gh/apache/shardingsphere/pull/10558?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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645955068



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/delete.xml
##########
@@ -366,7 +366,7 @@
                     <column name="order_id" start-index="10" stop-index="17"/>
                     <column name="user_id" start-index="20" stop-index="26"/>
                 </columns>
-                <subquery-expression>
+                <subquery-expression start-index="32" stop-index="70">

Review comment:
       Since I tried to assert the `SubquerySegment` of `CommonTableExpressionSegment` in `WithClauseAssert`, I needed to provide start and stop indices for all `subquery-expression`s within `common-table-expression`s as they were asserted. 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644400745



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rules: `whereClause`, `groupByClause`, `havingClause`. They need to be checked whether it is the same as the definition of the oracle rule.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645215312



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause

Review comment:
       ![Uploading image.png…]()
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645908467



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDMLStatementSQLVisitor.java
##########
@@ -243,7 +243,7 @@ public ASTNode visitWithClause(final WithClauseContext ctx) {
         List<CteClauseContext> cteClauses = ctx.cteClause();
         Collection<CommonTableExpressionSegment> commonTableExpressions = new LinkedList<>();
         for (CteClauseContext cte : cteClauses) {
-            SubquerySegment subquery = new SubquerySegment(cte.start.getStartIndex(), cte.stop.getStopIndex(), (SQLServerSelectStatement) visit(cte.subquery()));
+            SubquerySegment subquery = new SubquerySegment(cte.subquery().start.getStartIndex(), cte.subquery().stop.getStopIndex(), (SQLServerSelectStatement) visit(cte.subquery()));

Review comment:
       Why do you modify the SQLServer visitor?
   As this pr is only for Oracle.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r647611156



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       I've added a new rule in `predicate` as `bitExpr NOT? IN LP_ expr (COMMA_ expr)* RP_ AND predicate` that matches with the above example:
   
   ![PredicateRuleInFilterClause](https://user-images.githubusercontent.com/48581379/121223122-d5144800-c8a4-11eb-879e-a3cbf32b1325.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644397493



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `duplicateSpecification` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567102-80577400-c443-11eb-906a-b4ce1361a8dd.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645906094



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       ![image](https://user-images.githubusercontent.com/22066046/120872435-58961680-c5d1-11eb-9c09-4c09052b054b.png)
   
   @ThanoshanMV Is it suitable that 'predicate' is written as an 'expr'?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851029852


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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 [#10558](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f3a2708) into [master](https://codecov.io/gh/apache/shardingsphere/commit/face2667cf255c96a794f5dad650e53bbd26c344?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (face266) will **increase** coverage by `0.37%`.
   > The diff coverage is `59.09%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/10558/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #10558      +/-   ##
   ============================================
   + Coverage     68.43%   68.80%   +0.37%     
   - Complexity      727      740      +13     
   ============================================
     Files          1772     1776       +4     
     Lines         30601    30648      +47     
     Branches       5496     5509      +13     
   ============================================
   + Hits          20941    21088     +147     
   + Misses         8029     7939      -90     
   + Partials       1631     1621      -10     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rser/sql/common/statement/dml/SelectStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kbWwvU2VsZWN0U3RhdGVtZW50LmphdmE=) | `66.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [...ql/dialect/handler/dml/SelectStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9TZWxlY3RTdGF0ZW1lbnRIYW5kbGVyLmphdmE=) | `62.50% <0.00%> (-8.93%)` | :arrow_down: |
   | [...r/statement/impl/OracleDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `73.89% <70.58%> (-0.11%)` | :arrow_down: |
   | [...tatement/impl/SQLServerDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1zcWxzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvc3Fsc2VydmVyL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvU1FMU2VydmVyRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `87.05% <100.00%> (+0.08%)` | :arrow_up: |
   | [...ken/pojo/generic/SubstitutableColumnNameToken.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtcmV3cml0ZS9zaGFyZGluZ3NwaGVyZS1pbmZyYS1yZXdyaXRlLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvaW5mcmEvcmV3cml0ZS9zcWwvdG9rZW4vcG9qby9nZW5lcmljL1N1YnN0aXR1dGFibGVDb2x1bW5OYW1lVG9rZW4uamF2YQ==) | `45.45% <0.00%> (-54.55%)` | :arrow_down: |
   | [...packet/handshake/MySQLAuthSwitchRequestPacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVxdWVzdFBhY2tldC5qYXZh) | `30.76% <0.00%> (-49.24%)` | :arrow_down: |
   | [...acket/handshake/MySQLAuthSwitchResponsePacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVzcG9uc2VQYWNrZXQuamF2YQ==) | `57.14% <0.00%> (-42.86%)` | :arrow_down: |
   | [...ling/mysql/client/netty/MySQLNegotiateHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvbmV0dHkvTXlTUUxOZWdvdGlhdGVIYW5kbGVyLmphdmE=) | `48.78% <0.00%> (-41.70%)` | :arrow_down: |
   | [...dl/impl/CreateShardingTableRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQ3JlYXRlU2hhcmRpbmdUYWJsZVJ1bGVCYWNrZW5kSGFuZGxlci5qYXZh) | `80.00% <0.00%> (-9.29%)` | :arrow_down: |
   | [...phere/scaling/mysql/client/PasswordEncryption.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvUGFzc3dvcmRFbmNyeXB0aW9uLmphdmE=) | `91.17% <0.00%> (-8.83%)` | :arrow_down: |
   | ... and [372 more](https://codecov.io/gh/apache/shardingsphere/pull/10558/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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/10558?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 [face266...f3a2708](https://codecov.io/gh/apache/shardingsphere/pull/10558?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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-853460680


   @ThanoshanMV Some conflicts need to be resolved.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645215312



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause

Review comment:
       
   ![image](https://user-images.githubusercontent.com/22066046/120728895-70f22c80-c510-11eb-92b5-006758b8304f.png)
   
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644397493



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `duplicateSpecification` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567102-80577400-c443-11eb-906a-b4ce1361a8dd.png)
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `projections` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567289-f6f47180-c443-11eb-8a00-93d371e29fa2.png)
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `fromClause` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567572-b9441880-c444-11eb-9c0b-77507c3b08d9.png)
   
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rules: `whereClause`, `groupByClause`, `havingClause`. They need to be checked whether it is the same as the definition of the oracle rule.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       I agree with you.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause
+    : measName AS LP_ calcMeasExpression RP_
+    ;
+
+calcMeasExpression
+    : avExpression | expr
+    ;
+
+avExpression
+    : avMeasExpression | avHierExpression
+    ;
+
+avMeasExpression
+    : leadLagExpression | windowExpression | rankExpression | shareOfExpression | qdrExpression
+    ;
+
+leadLagExpression
+    : leadLagFunctionName LP_ calcMeasExpression RP_ OVER LP_ leadLagClause RP_
+    ;
+
+leadLagFunctionName
+    : LAG | LAG_DIFF | LAG_DIF_PERCENT | LEAD | LEAD_DIFF | LEAD_DIFF_PERCENT
+    ;
+
+leadLagClause
+    : HIERARCHY hierarchyRef OFFSET offsetExpr ((WITHIN (LEVEL | PARENT)) | (ACROSS ANCESTOR AT LEVEL levelRef (POSITION FROM (BEGINNING | END))?))?
+    ;
+
+hierarchyRef
+    : (alias DOT_)? alias
+    ;
+

Review comment:
       I've checked the rule `alias`. 
   Could you put the below rule into the BaseRule.g4?
   ```
   alias
       : identifier | STRING_
       ;
   ```

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause

Review comment:
       ![image](https://user-images.githubusercontent.com/22066046/120728695-0d67ff00-c510-11eb-8212-0f76633ba836.png)
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause

Review comment:
       ![Uploading image.png…]()
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause

Review comment:
       
   ![image](https://user-images.githubusercontent.com/22066046/120728895-70f22c80-c510-11eb-92b5-006758b8304f.png)
   
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       ![image](https://user-images.githubusercontent.com/22066046/120728991-a72fac00-c510-11eb-9b2b-b555d908fa17.png)
   

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause

Review comment:
       Could you put a reference link of the rule `calcMeasClause`?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644513278



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       Hi @wgy8283335, yes the above-mentioned rules aren't aligned with Oracle documentation rules. Since `withClause` contains a lot of changes, I only put `withClause` definition in this PR. I thought to proofread each rule in the `queryBlock` with seperate PRs. What do you think?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644513278



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       Hi @wgy8283335, yes the above-mentioned rules aren't aligned with Oracle documentation rules. Since `withClause` contains a lot of changes, I only put `withClause` definition in this PR. I thought to proofread each rule in the `queryBlock` with seperate PRs. What do you think?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645948803



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       I earlier put `predicate` for `filterClause`, it parsed them correctly for two examples in the above image but there's another example SQL statement that defines a transitory analytic view using a filter clause:
   
   ![FilterFactClause](https://user-images.githubusercontent.com/48581379/120881821-796e6400-c5f1-11eb-9ea1-0fd59764edd6.png)
   
   The above statement is failed to parse correctly when I specified `predicate`:
   
   ![PredicateRuleFailure](https://user-images.githubusercontent.com/48581379/120881877-dcf89180-c5f1-11eb-9aa3-3b4bd6899f24.png)
   
   Then I changed `predicate` to `expr`:
   
   ![ExprRuleSuccess](https://user-images.githubusercontent.com/48581379/120881922-247f1d80-c5f2-11eb-966f-9a5dae1dfb99.png)
   
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645210807



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause
+    : measName AS LP_ calcMeasExpression RP_
+    ;
+
+calcMeasExpression
+    : avExpression | expr
+    ;
+
+avExpression
+    : avMeasExpression | avHierExpression
+    ;
+
+avMeasExpression
+    : leadLagExpression | windowExpression | rankExpression | shareOfExpression | qdrExpression
+    ;
+
+leadLagExpression
+    : leadLagFunctionName LP_ calcMeasExpression RP_ OVER LP_ leadLagClause RP_
+    ;
+
+leadLagFunctionName
+    : LAG | LAG_DIFF | LAG_DIF_PERCENT | LEAD | LEAD_DIFF | LEAD_DIFF_PERCENT
+    ;
+
+leadLagClause
+    : HIERARCHY hierarchyRef OFFSET offsetExpr ((WITHIN (LEVEL | PARENT)) | (ACROSS ANCESTOR AT LEVEL levelRef (POSITION FROM (BEGINNING | END))?))?
+    ;
+
+hierarchyRef
+    : (alias DOT_)? alias
+    ;
+

Review comment:
       I've checked the rule `alias`. 
   Could you put the below rule into the BaseRule.g4?
   ```
   alias
       : identifier | STRING_
       ;
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r644398461



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?

Review comment:
       The rule `projections` is not the same as definition in oracle rule.
   ![image](https://user-images.githubusercontent.com/22066046/120567289-f6f47180-c443-11eb-8a00-93d371e29fa2.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645950872



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/SelectStatement.java
##########
@@ -50,6 +51,8 @@
     
     private OrderBySegment orderBy;
     
+    private WithSegment withSegment;

Review comment:
       I found that `withClause` is available for [SQL Server](https://docs.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql?view=sql-server-ver15), [PostgreSQL](https://www.postgresql.org/docs/current/queries-with.html), and [MySQL](https://dev.mysql.com/doc/refman/8.0/en/with.html). So I put `WithSegment` in `SelectStatement`.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645906447



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/dml/select-with.xml
##########
@@ -0,0 +1,22 @@
+<?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="select_with_subquery_factoring" value="WITH dept_costs AS (SELECT department_name, SUM(salary) dept_total FROM departments d GROUP BY department_name) SELECT * FROM dept_costs WHERE dept_total > 304500 ORDER BY department_name" db-types="Oracle"/>

Review comment:
       It's better to add more test cases.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645649611



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause

Review comment:
       Yes, I'll put it here.
   
   ![CalculatedMeasureClause](https://user-images.githubusercontent.com/48581379/120823142-c06a4400-c574-11eb-9354-c8619ba05cdb.png)
   
   Here is the [reference link to `calc_meas_expression`](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/analytic-view-measure-expressions.html#GUID-F8C7ED67-A4EC-479C-975F-12F1F4B8CBA0).




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r647035687



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause

Review comment:
       Maybe you should add some rules for the predicate.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-853460680


   @ThanoshanMV Some conflicts need to be resolved.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851029852


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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 [#10558](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9ad33fa) into [master](https://codecov.io/gh/apache/shardingsphere/commit/face2667cf255c96a794f5dad650e53bbd26c344?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (face266) will **decrease** coverage by `3.24%`.
   > The diff coverage is `76.19%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/10558/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #10558      +/-   ##
   ============================================
   - Coverage     68.43%   65.18%   -3.25%     
   + Complexity      727      689      -38     
   ============================================
     Files          1772     1774       +2     
     Lines         30601    30706     +105     
     Branches       5496     5523      +27     
   ============================================
   - Hits          20941    20016     -925     
   - Misses         8029     9103    +1074     
   + Partials       1631     1587      -44     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rser/sql/common/statement/dml/SelectStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kbWwvU2VsZWN0U3RhdGVtZW50LmphdmE=) | `66.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [...ql/dialect/handler/dml/SelectStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9TZWxlY3RTdGF0ZW1lbnRIYW5kbGVyLmphdmE=) | `62.50% <0.00%> (-8.93%)` | :arrow_down: |
   | [...r/statement/impl/OracleDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `76.65% <93.75%> (+2.65%)` | :arrow_up: |
   | [...tatement/impl/SQLServerDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1zcWxzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvc3Fsc2VydmVyL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvU1FMU2VydmVyRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `87.05% <100.00%> (+0.08%)` | :arrow_up: |
   | [...packet/handshake/MySQLAuthSwitchRequestPacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVxdWVzdFBhY2tldC5qYXZh) | `30.76% <0.00%> (-49.24%)` | :arrow_down: |
   | [...acket/handshake/MySQLAuthSwitchResponsePacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVzcG9uc2VQYWNrZXQuamF2YQ==) | `57.14% <0.00%> (-42.86%)` | :arrow_down: |
   | [...ling/mysql/client/netty/MySQLNegotiateHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvbmV0dHkvTXlTUUxOZWdvdGlhdGVIYW5kbGVyLmphdmE=) | `48.78% <0.00%> (-41.70%)` | :arrow_down: |
   | [...dl/impl/CreateShardingTableRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQ3JlYXRlU2hhcmRpbmdUYWJsZVJ1bGVCYWNrZW5kSGFuZGxlci5qYXZh) | `75.60% <0.00%> (-13.68%)` | :arrow_down: |
   | [...phere/scaling/mysql/client/PasswordEncryption.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvUGFzc3dvcmRFbmNyeXB0aW9uLmphdmE=) | `91.17% <0.00%> (-8.83%)` | :arrow_down: |
   | [...rdl/impl/AlterShardingTableRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQWx0ZXJTaGFyZGluZ1RhYmxlUnVsZUJhY2tlbmRIYW5kbGVyLmphdmE=) | `89.06% <0.00%> (-8.50%)` | :arrow_down: |
   | ... and [653 more](https://codecov.io/gh/apache/shardingsphere/pull/10558/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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/10558?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 [face266...9ad33fa](https://codecov.io/gh/apache/shardingsphere/pull/10558?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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645218403



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause
+    : CYCLE alias (COMMA_ alias)* SET alias TO cycleValue DEFAULT noCycleValue
+    ;
+
+subavFactoringClause
+    : subavName ANALYTIC VIEW AS LP_ subavClause RP_
+    ;
+
+subavClause
+    : USING baseAvName hierarchiesClause? filterClauses? addCalcsClause?
+    ;
+
+hierarchiesClause
+    : HIERARCHIES LP_ ((alias DOT_)? alias (COMMA_ (alias DOT_)? alias)*)? RP_
+    ;
+
+filterClauses
+    : FILTER FACT LP_ filterClause (COMMA_ filterClause)* RP_
+    ;
+
+filterClause
+    : (MEASURES | (alias DOT_)? alias) TO expr
+    ;
+
+addCalcsClause
+    : ADD MEASURES LP_ calcMeasClause (COMMA_ calcMeasClause)* RP_
+    ;
+
+calcMeasClause

Review comment:
       Could you put a reference link of the rule `calcMeasClause`?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#discussion_r645214688



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -121,7 +121,223 @@ unionClause
     ;
 
 queryBlock
-    : SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    : withClause? SELECT duplicateSpecification? projections fromClause? whereClause? groupByClause? havingClause?
+    ;
+
+withClause
+    : WITH plsqlDeclarations? ((subqueryFactoringClause | subavFactoringClause) (COMMA_ (subqueryFactoringClause | subavFactoringClause))*)?
+    ;
+
+plsqlDeclarations
+    : (functionDeclaration | procedureDeclaration)+
+    ;
+
+functionDeclaration
+    : functionHeading ((DETERMINISTIC | PIPELINED | PARALLEL_ENABLE | RESULT_CACHE)+)?
+    ;
+
+functionHeading
+    : FUNCTION functionName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)? RETURN dataType
+    ;
+
+parameterDeclaration
+    : parameterName ((IN? dataType ((COLON_ EQ_ | DEFAULT) expr)?) | (IN? OUT NOCOPY? dataType))?
+    ;
+
+procedureDeclaration
+    : procedureHeading procedureProperties
+    ;
+
+procedureHeading
+    : PROCEDURE procedureName (LP_ parameterDeclaration (SQ_ parameterDeclaration)* RP_)?
+    ;
+
+procedureProperties
+    : (accessibleByClause | defaultCollationClause | invokerRightsClause)*
+    ;
+
+accessibleByClause
+    : ACCESSIBLE BY LP_ accessor (COMMA_ accessor)* RP_
+    ;
+
+accessor
+    : unitKind? unitName
+    ;
+
+unitKind
+    : FUNCTION | PROCEDURE | PACKAGE | TRIGGER | TYPE
+    ;
+
+defaultCollationClause
+    : DEFAULT COLLATION collationOption
+    ;
+
+collationOption
+    : USING_NLS_COMP
+    ;
+
+invokerRightsClause
+    : AUTHID (CURRENT_USER | DEFINER)
+    ;
+
+subqueryFactoringClause
+    : queryName (LP_ alias (COMMA_ alias)* RP_)? AS LP_ selectSubquery RP_ searchClause? cycleClause? 
+    ;
+
+searchClause
+    : SEARCH (DEPTH | BREADTH) FIRST BY (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?) (COMMA_ (alias (ASC | DESC)? (NULLS FIRST | NULLS LAST)?))* SET orderingColumn
+    ;
+
+cycleClause

Review comment:
       ![image](https://user-images.githubusercontent.com/22066046/120728695-0d67ff00-c510-11eb-8212-0f76633ba836.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #10558: Add with clause for Oracle `SELECT` statement

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #10558:
URL: https://github.com/apache/shardingsphere/pull/10558#issuecomment-851029852


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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 [#10558](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d630fc5) into [master](https://codecov.io/gh/apache/shardingsphere/commit/face2667cf255c96a794f5dad650e53bbd26c344?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (face266) will **decrease** coverage by `3.35%`.
   > The diff coverage is `76.19%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/10558/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #10558      +/-   ##
   ============================================
   - Coverage     68.43%   65.07%   -3.36%     
   + Complexity      727      688      -39     
   ============================================
     Files          1772     1776       +4     
     Lines         30601    30653      +52     
     Branches       5496     5509      +13     
   ============================================
   - Hits          20941    19948     -993     
   - Misses         8029     9130    +1101     
   + Partials       1631     1575      -56     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/10558?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rser/sql/common/statement/dml/SelectStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kbWwvU2VsZWN0U3RhdGVtZW50LmphdmE=) | `66.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [...ql/dialect/handler/dml/SelectStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9TZWxlY3RTdGF0ZW1lbnRIYW5kbGVyLmphdmE=) | `62.50% <0.00%> (-8.93%)` | :arrow_down: |
   | [...r/statement/impl/OracleDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcmFjbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3JhY2xlL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3JhY2xlRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `76.65% <93.75%> (+2.65%)` | :arrow_up: |
   | [...tatement/impl/SQLServerDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1zcWxzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvc3Fsc2VydmVyL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvU1FMU2VydmVyRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `87.05% <100.00%> (+0.08%)` | :arrow_up: |
   | [...ken/pojo/generic/SubstitutableColumnNameToken.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtcmV3cml0ZS9zaGFyZGluZ3NwaGVyZS1pbmZyYS1yZXdyaXRlLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvaW5mcmEvcmV3cml0ZS9zcWwvdG9rZW4vcG9qby9nZW5lcmljL1N1YnN0aXR1dGFibGVDb2x1bW5OYW1lVG9rZW4uamF2YQ==) | `45.45% <0.00%> (-54.55%)` | :arrow_down: |
   | [...packet/handshake/MySQLAuthSwitchRequestPacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVxdWVzdFBhY2tldC5qYXZh) | `30.76% <0.00%> (-49.24%)` | :arrow_down: |
   | [...acket/handshake/MySQLAuthSwitchResponsePacket.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL3BhY2tldC9oYW5kc2hha2UvTXlTUUxBdXRoU3dpdGNoUmVzcG9uc2VQYWNrZXQuamF2YQ==) | `57.14% <0.00%> (-42.86%)` | :arrow_down: |
   | [...ling/mysql/client/netty/MySQLNegotiateHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvbmV0dHkvTXlTUUxOZWdvdGlhdGVIYW5kbGVyLmphdmE=) | `48.78% <0.00%> (-41.70%)` | :arrow_down: |
   | [...dl/impl/CreateShardingTableRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQ3JlYXRlU2hhcmRpbmdUYWJsZVJ1bGVCYWNrZW5kSGFuZGxlci5qYXZh) | `80.00% <0.00%> (-9.29%)` | :arrow_down: |
   | [...phere/scaling/mysql/client/PasswordEncryption.java](https://codecov.io/gh/apache/shardingsphere/pull/10558/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-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc2NhbGluZy1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9teXNxbC9jbGllbnQvUGFzc3dvcmRFbmNyeXB0aW9uLmphdmE=) | `91.17% <0.00%> (-8.83%)` | :arrow_down: |
   | ... and [576 more](https://codecov.io/gh/apache/shardingsphere/pull/10558/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10558?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/10558?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 [face266...d630fc5](https://codecov.io/gh/apache/shardingsphere/pull/10558?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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org