Skip to content

Conversation

@caicancai
Copy link
Member

@caicancai caicancai commented Jan 12, 2025

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

@caicancai caicancai requested a review from mihaibudiu January 13, 2025 02:40
Copy link
Member

@zabetak zabetak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in the JIRA, without a test case or a clear problem statement/description it will not be easy to merge a fix.

@caicancai caicancai requested a review from zabetak January 13, 2025 14:41
@caicancai caicancai marked this pull request as draft January 26, 2025 14:24
@caicancai caicancai self-assigned this Jan 26, 2025
@F21 F21 force-pushed the main branch 8 times, most recently from c7cee40 to a9dc6f8 Compare February 23, 2025 22:29
@caicancai caicancai closed this Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants