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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to