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 2020/09/15 15:45:45 UTC

[GitHub] [shardingsphere] strongduanmu opened a new pull request #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

strongduanmu opened a new pull request #7469:
URL: https://github.com/apache/shardingsphere/pull/7469


   Ref #7170.
   
   Changes proposed in this pull request:
   - refactor CallStatement, DeleteStatement and DoStatement in DMLStatement
   


----------------------------------------------------------------
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 #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

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


   


----------------------------------------------------------------
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] coveralls edited a comment on pull request #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #7469:
URL: https://github.com/apache/shardingsphere/pull/7469#issuecomment-692856333


   ## Pull Request Test Coverage Report for [Build 14817](https://coveralls.io/builds/33493791)
   
   * **5** of **25**   **(20.0%)**  changed or added relevant lines in **18** files are covered.
   * **17** unchanged lines in **2** files lost coverage.
   * Overall coverage increased (+**0.04%**) to **35.047%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/CallStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FCallStatement.java#L25) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/DeleteStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FDeleteStatement.java#L33) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/DoStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FDoStatement.java#L25) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dml/MySQLCallStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fmysql%2Fdml%2FMySQLCallStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dml/MySQLDoStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fmysql%2Fdml%2FMySQLDoStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/dml/OracleDeleteStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Foracle%2Fdml%2FOracleDeleteStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLCallStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLCallStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLDeleteStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLDeleteStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLDoStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLDoStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sql92/dml/SQL92DeleteStatement.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fsql92%2Fdml%2FSQL92DeleteStatement.java#L26) | 0 | 1 | 0.0%
   <!-- | **Total:** | **5** | **25** | **20.0%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-binder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fbinder%2Fsegment%2Fselect%2Fprojection%2Fengine%2FProjectionsContextEngine.java#L111) | 8 | 80.0% |
   | [shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java](https://coveralls.io/builds/33493791/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-frontend%2Fshardingsphere-proxy-frontend-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Ffrontend%2FShardingSphereProxy.java#L41) | 9 | 0% |
   <!-- | **Total:** | **17** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33493791/badge)](https://coveralls.io/builds/33493791) |
   | :-- | --: |
   | Change from base [Build 14805](https://coveralls.io/builds/33479016): |  0.04% |
   | Covered Lines: | 36539 |
   | Relevant Lines: | 104258 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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] coveralls commented on pull request #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

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


   ## Pull Request Test Coverage Report for [Build 14806](https://coveralls.io/builds/33479570)
   
   * **5** of **24**   **(20.83%)**  changed or added relevant lines in **18** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage decreased (**-0.003%**) to **35.007%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/impl/ShardingDeleteStatementValidator.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-features%2Fshardingsphere-sharding%2Fshardingsphere-sharding-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsharding%2Froute%2Fengine%2Fvalidator%2Fimpl%2FShardingDeleteStatementValidator.java#L47) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/CallStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FCallStatement.java#L25) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/DeleteStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FDeleteStatement.java#L33) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/DoStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fcommon%2Fstatement%2Fdml%2FDoStatement.java#L25) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dml/MySQLCallStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fmysql%2Fdml%2FMySQLCallStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dml/MySQLDoStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fmysql%2Fdml%2FMySQLDoStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/dml/OracleDeleteStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Foracle%2Fdml%2FOracleDeleteStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLCallStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLCallStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLDeleteStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLDeleteStatement.java#L26) | 0 | 1 | 0.0%
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/dml/PostgreSQLDoStatement.java](https://coveralls.io/builds/33479570/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-statement%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsql%2Fdialect%2Fstatement%2Fpostgresql%2Fdml%2FPostgreSQLDoStatement.java#L26) | 0 | 1 | 0.0%
   <!-- | **Total:** | **5** | **24** | **20.83%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33479570/badge)](https://coveralls.io/builds/33479570) |
   | :-- | --: |
   | Change from base [Build 14805](https://coveralls.io/builds/33479016): |  -0.003% |
   | Covered Lines: | 36501 |
   | Relevant Lines: | 104268 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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] strongduanmu commented on a change in pull request #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

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



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/impl/ShardingDeleteStatementValidator.java
##########
@@ -42,7 +44,7 @@ public void preValidate(final ShardingRule shardingRule, final RouteContext rout
     
     @Override
     public void postValidate(final DeleteStatement sqlStatement, final RouteResult routeResult) {
-        if (sqlStatement.getLimit().isPresent() && routeResult.getRouteUnits().size() > 1) {
+        if (sqlStatement instanceof MySQLStatement && ((MySQLDeleteStatement) sqlStatement).getLimit().isPresent() && routeResult.getRouteUnits().size() > 1) {

Review comment:
       > Extracting a function is better.
   
   @tristaZero I will optimize 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] strongduanmu commented on a change in pull request #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

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



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dml/impl/DeleteStatementAssert.java
##########
@@ -49,8 +51,10 @@
     public static void assertIs(final SQLCaseAssertContext assertContext, final DeleteStatement actual, final DeleteStatementTestCase expected) {
         assertTable(assertContext, actual, expected);
         assertWhereClause(assertContext, actual, expected);
-        assertOrderByClause(assertContext, actual, expected);
-        assertLimitClause(assertContext, actual, expected);
+        if (actual instanceof MySQLStatement) {
+            assertOrderByClause(assertContext, (MySQLDeleteStatement) actual, expected);
+            assertLimitClause(assertContext, (MySQLDeleteStatement) actual, expected);    
+        }

Review comment:
       > It is an optional item. Just from my glance, my feeling is that it is better to gather this judgment and handling detail into a function.
   
   It is a good idea. 👍




----------------------------------------------------------------
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 #7469: refactor CallStatement, DeleteStatement and DoStatement in DMLStatement

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



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/impl/ShardingDeleteStatementValidator.java
##########
@@ -42,7 +44,7 @@ public void preValidate(final ShardingRule shardingRule, final RouteContext rout
     
     @Override
     public void postValidate(final DeleteStatement sqlStatement, final RouteResult routeResult) {
-        if (sqlStatement.getLimit().isPresent() && routeResult.getRouteUnits().size() > 1) {
+        if (sqlStatement instanceof MySQLStatement && ((MySQLDeleteStatement) sqlStatement).getLimit().isPresent() && routeResult.getRouteUnits().size() > 1) {

Review comment:
       Extracting a function is better.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dml/impl/DeleteStatementAssert.java
##########
@@ -49,8 +51,10 @@
     public static void assertIs(final SQLCaseAssertContext assertContext, final DeleteStatement actual, final DeleteStatementTestCase expected) {
         assertTable(assertContext, actual, expected);
         assertWhereClause(assertContext, actual, expected);
-        assertOrderByClause(assertContext, actual, expected);
-        assertLimitClause(assertContext, actual, expected);
+        if (actual instanceof MySQLStatement) {
+            assertOrderByClause(assertContext, (MySQLDeleteStatement) actual, expected);
+            assertLimitClause(assertContext, (MySQLDeleteStatement) actual, expected);    
+        }

Review comment:
       How about to extract A function named `assertXXXXX`

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dml/impl/DeleteStatementAssert.java
##########
@@ -49,8 +51,10 @@
     public static void assertIs(final SQLCaseAssertContext assertContext, final DeleteStatement actual, final DeleteStatementTestCase expected) {
         assertTable(assertContext, actual, expected);
         assertWhereClause(assertContext, actual, expected);
-        assertOrderByClause(assertContext, actual, expected);
-        assertLimitClause(assertContext, actual, expected);
+        if (actual instanceof MySQLStatement) {
+            assertOrderByClause(assertContext, (MySQLDeleteStatement) actual, expected);
+            assertLimitClause(assertContext, (MySQLDeleteStatement) actual, expected);    
+        }

Review comment:
       It is an optional item. Just from my glance, my feeling is that it is better to gather this judgment and handling detail into a function. 




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