You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Bill Bejeck (Jira)" <ji...@apache.org> on 2026/05/05 16:39:00 UTC

[jira] [Resolved] (KAFKA-15768) StateQueryResult#getOnlyPartitionResult should not throw for FailedQueryResult

     [ https://issues.apache.org/jira/browse/KAFKA-15768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Bejeck resolved KAFKA-15768.
---------------------------------
    Resolution: Fixed

> StateQueryResult#getOnlyPartitionResult should not throw for FailedQueryResult
> ------------------------------------------------------------------------------
>
>                 Key: KAFKA-15768
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15768
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Matthias J. Sax
>            Assignee: Gavin Wang
>            Priority: Major
>             Fix For: 4.4.0
>
>
> Calling `StateQueryResult#getOnlyPartitionResult` crashes with an incorrect `IllegalArgumentException` if any result is a `FailedQueryResult` (and even if there is only a single FailedQueryResult).
> The issue is the internal `filter(r -> r.getResult() != 0)` step, that blindly (and incorrectly) calls `getResult`.
> Given the semantics of `getOnlyPartitionResult` we should not care if the result is SuccessQueryResult or FailedQueryResult, but only check if there is a single result or not. (The user has no means to avoid getting the underlying error otherwise.)
> Side-note: why does `FailedQueryResult#getResult` throw an IllegalArgumentException (there is no argument passed into the method – it should rather be an `IllegalStateException` – but I guess we would need a KIP for this fix?)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)