[
https://issues.apache.org/jira/browse/KAFKA-15768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matthias J. Sax updated KAFKA-15768:
------------------------------------
Description:
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 not means to avoid getting an exception
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?)
was:
Calling `StateQueryResult#getOnlyPartitionResult` crashes with an incorrect
`IllegalArgumentException` if the 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 not means to avoid getting an exception
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?)
> 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: Hanyu Zheng
> Priority: Major
>
> 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 not means to avoid getting an exception
> 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)