You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/12/28 08:35:47 UTC

[GitHub] [ignite] ilhomu opened a new pull request, #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

ilhomu opened a new pull request, #10464:
URL: https://github.com/apache/ignite/pull/10464

   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] ilhomu commented on a diff in pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
ilhomu commented on code in PR #10464:
URL: https://github.com/apache/ignite/pull/10464#discussion_r1059314785


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java:
##########
@@ -458,6 +458,45 @@ public void testMergeKeysConflict() {
             "Failed to MERGE some keys due to keys conflict");
     }
 
+    /**
+     * Ensure that DML operations fails with proper errors on non-existent table
+     */
+    @Test
+    public void testFailureOnNonExistentTable() {
+        assertThrows("INSERT INTO NON_EXISTENT_TABLE(ID, NAME) VALUES (1, 'Name')",
+            IgniteSQLException.class,
+            "Failed to validate query. From line 1, column 13 to line 1, column 30: " +

Review Comment:
   Sure. Much better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] ilhomu commented on a diff in pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
ilhomu commented on code in PR #10464:
URL: https://github.com/apache/ignite/pull/10464#discussion_r1059331587


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PrepareServiceImpl.java:
##########
@@ -102,9 +102,14 @@ public PrepareServiceImpl(GridKernalContext ctx) {
                         "querySql=\"" + ctx.query() + "\"]", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
             }
         }
-        catch (ValidationException | CalciteContextException e) {
+        catch (CalciteContextException e) {
             throw new IgniteSQLException("Failed to validate query. " + e.getMessage(), IgniteQueryErrorCode.PARSING, e);
         }
+        catch (ValidationException e) {
+            String cause = e.getCause() == null ? e.getMessage() : e.getCause().getMessage();
+
+            throw new IgniteSQLException("Failed to validate query. " + cause, IgniteQueryErrorCode.PARSING, e);
+        }

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] ilhomu commented on a diff in pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
ilhomu commented on code in PR #10464:
URL: https://github.com/apache/ignite/pull/10464#discussion_r1059314647


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PrepareServiceImpl.java:
##########
@@ -102,9 +102,14 @@ public PrepareServiceImpl(GridKernalContext ctx) {
                         "querySql=\"" + ctx.query() + "\"]", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
             }
         }
-        catch (ValidationException | CalciteContextException e) {
+        catch (CalciteContextException e) {
             throw new IgniteSQLException("Failed to validate query. " + e.getMessage(), IgniteQueryErrorCode.PARSING, e);
         }
+        catch (ValidationException e) {
+            String cause = e.getCause() == null ? e.getMessage() : e.getCause().getMessage();
+
+            throw new IgniteSQLException("Failed to validate query. " + cause, IgniteQueryErrorCode.PARSING, e);
+        }

Review Comment:
   imho, there is no need to have ValidationException at all. I have killed off it from the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] alex-plekhanov commented on a diff in pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on code in PR #10464:
URL: https://github.com/apache/ignite/pull/10464#discussion_r1058965837


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java:
##########
@@ -458,6 +458,45 @@ public void testMergeKeysConflict() {
             "Failed to MERGE some keys due to keys conflict");
     }
 
+    /**
+     * Ensure that DML operations fails with proper errors on non-existent table
+     */
+    @Test
+    public void testFailureOnNonExistentTable() {
+        assertThrows("INSERT INTO NON_EXISTENT_TABLE(ID, NAME) VALUES (1, 'Name')",
+            IgniteSQLException.class,
+            "Failed to validate query. From line 1, column 13 to line 1, column 30: " +

Review Comment:
   Let's just check substring `"Object 'NON_EXISTENT_TABLE' not found"`, not full message (checking position looking weird, at least for UPDATE statement with column 1-55)



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PrepareServiceImpl.java:
##########
@@ -102,9 +102,14 @@ public PrepareServiceImpl(GridKernalContext ctx) {
                         "querySql=\"" + ctx.query() + "\"]", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
             }
         }
-        catch (ValidationException | CalciteContextException e) {
+        catch (CalciteContextException e) {
             throw new IgniteSQLException("Failed to validate query. " + e.getMessage(), IgniteQueryErrorCode.PARSING, e);
         }
+        catch (ValidationException e) {
+            String cause = e.getCause() == null ? e.getMessage() : e.getCause().getMessage();
+
+            throw new IgniteSQLException("Failed to validate query. " + cause, IgniteQueryErrorCode.PARSING, e);
+        }

Review Comment:
   Let's change `IgnitePlanner.validate()` instead (construct `ValidationException` with the correct message).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] asfgit closed pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table
URL: https://github.com/apache/ignite/pull/10464


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] ilhomu commented on a diff in pull request #10464: IGNITE-18458 Fixed NPE on DML on non-existed table

Posted by GitBox <gi...@apache.org>.
ilhomu commented on code in PR #10464:
URL: https://github.com/apache/ignite/pull/10464#discussion_r1059314647


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PrepareServiceImpl.java:
##########
@@ -102,9 +102,14 @@ public PrepareServiceImpl(GridKernalContext ctx) {
                         "querySql=\"" + ctx.query() + "\"]", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
             }
         }
-        catch (ValidationException | CalciteContextException e) {
+        catch (CalciteContextException e) {
             throw new IgniteSQLException("Failed to validate query. " + e.getMessage(), IgniteQueryErrorCode.PARSING, e);
         }
+        catch (ValidationException e) {
+            String cause = e.getCause() == null ? e.getMessage() : e.getCause().getMessage();
+
+            throw new IgniteSQLException("Failed to validate query. " + cause, IgniteQueryErrorCode.PARSING, e);
+        }

Review Comment:
   imho, there is no need to have ValidationException at all. I have killed off it from the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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