[CALCITE-6781] The isUpdateCapable method of calcite.avatica will incorrectly traverse the returned result value #267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/CALCITE-6781
Recently I am adapting the delete statement of es, but when I support delete * from where condition and similar statements, an error will be reported in the isUpdateCapable method, as follows
java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END
The reason is that the openResultSet.next() of the delete statement is false. In the current isUpdateCapable method, whether openResultSet.next() is true or false, it will perform subsequent operations.
But when openResultSet.next() is false,
statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME)
will throw the exception I encountered above
So when openResultSet.next() is false, it should return null directly.
I am not very familiar with the avatica module, and I am not sure where to add the test
I also have a second solution signature.statementType.canUpdate() returns false which can also solve this problem