Matthias J. Sax created KAFKA-15768:
---------------------------------------

             Summary: 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


Calling `StateQueryResult#getOnlyPartitionResult` crashes with an incorrect 
`IllegalArgumentException` if the only result is a `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)

Reply via email to