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/07/27 06:34:40 UTC

[GitHub] [ignite-3] ptupitsyn commented on a diff in pull request #956: IGNITE-17135 Fix inconsistent SQL exceptions on server and client

ptupitsyn commented on code in PR #956:
URL: https://github.com/apache/ignite-3/pull/956#discussion_r930670735


##########
modules/api/src/main/java/org/apache/ignite/internal/sql/ResultSetImpl.java:
##########
@@ -83,7 +85,7 @@ public void close() {
     @Override
     public boolean hasNext() {
         if (it == null) {
-            throw new SqlException("There are no results");
+            throw new SqlException(QUERY_NO_RESULT_SET_ERR, "There are no results");

Review Comment:
   We should throw an exception. Returning `false` will produce misleading behavior:
   
   ```java
           ResultSet rs = ses.execute(null, "INSERT INTO TEST VALUES (?, ?)", 20, 30);
           rs.forEachRemaining(System.out::println);
   ```
   
   This will work without any errors if we return `false` from `hasNext`, but iterating over DML/DDL result set does not make sense. I think it's better to let the user know instead of silently allowing this.



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