[
https://issues.apache.org/jira/browse/CALCITE-6781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17912470#comment-17912470
]
Stamatis Zampetakis commented on CALCITE-6781:
----------------------------------------------
[~caicancai] How did you encounter the problem? In which context? Without a
test case or a clear problem statement it is not easy to merge any fixes.
Other than that 1.39.0 is a Calcite version not an Avatica version. The PR is
opened on the calcite-avatica repo so I guess the appropriate target version is
avatica-1.26.0. Likewise, in the affected version we should specify the avatica
ones.
> The isUpdateCapable method of calcite.avatica will incorrectly traverse the
> returned result value
> -------------------------------------------------------------------------------------------------
>
> Key: CALCITE-6781
> URL: https://issues.apache.org/jira/browse/CALCITE-6781
> Project: Calcite
> Issue Type: Bug
> Components: avatica
> Affects Versions: 1.35.0, 1.38.0
> Reporter: Caican Cai
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.39.0
>
>
> When the delete statement is executed, statement.openResultSet.next will
> return false, and we do not need to perform subsequent operations.
> {code:java}
> private void isUpdateCapable(final AvaticaStatement statement)
> throws SQLException {
> Meta.Signature signature = statement.getSignature();
> if (signature == null || signature.statementType == null) {
> return;
> }
> if (signature.statementType.canUpdate() && statement.updateCount == -1) {
> statement.openResultSet.next();
> Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME);
> if (obj instanceof Number) {
> statement.updateCount = ((Number) obj).intValue();
> } else if (obj instanceof List) {
> @SuppressWarnings("unchecked")
> final List<Number> numbers = (List<Number>) obj;
> statement.updateCount = numbers.get(0).intValue();
> } else {
> throw HELPER.createException("Not a valid return result.");
> }
> statement.openResultSet = null;
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)