Hi Shikhar,

Glad to be of help. Just notice that I forgot to attach the link in my first 
response. I put it here just in case anyone would need it.

[1] 
https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/dev/datastream/fault-tolerance/state_v2/
 
<https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/dev/datastream/fault-tolerance/state_v2/>

Sincerely,
Han Yin

> 2025年6月30日 14:49,Shikhar Raje <shikhar.r...@dream11.com> 写道:
> 
> Hi Yin,
> 
> I understand that #2 (adding `enableAsyncState()`) was the fix that I was 
> looking for. We're in the process of building new jobs, so, while #1 
> (reverting to v1) was working as a temporary fix, #2 is what we were really 
> looking for. 
> 
> Thank You for the prompt response, and your help!
> 
> Sincerely,
> Shikhar Raje
> 
> On Mon, Jun 30, 2025 at 10:14 AM Han Yin <alexyin...@gmail.com 
> <mailto:alexyin...@gmail.com>> wrote:
> Hi, Shikhar
> It seems you have used state V2 APIs in your code. Please check the imports 
> in your ```FraudDetector.java``` and you may see that ```ValueState``` and 
> ```ValueStateDescriptor``` are under 
> ```org.apache.flink.api.common.state.v2``` package.
> About your questions:
> 1. The asynchronous behavior introduced in `FraudDetector` is related to 
> state accessing with State V2. You can refer to link[1] for more information 
> about State V2.
> 2. To fix the problem, you can either:
>   (1) Change the imports to the following, to use State V1
> import org.apache.flink.api.common.state.ValueState;
> import org.apache.flink.api.common.state.ValueStateDescriptor;
>   (2) Or, in your ```FraudDetectionJob```, enable async state for the keyed 
> stream:
> DataStream<Alert> alerts = transactions
>         .keyBy(Transaction::getAccountId)
>         .enableAsyncState()
>         .process(new FraudDetector())
>         .name("fraud-detector");
> For both solutions I have checked locally and they should both work.
> 
>> 2025年6月27日 20:18,Shikhar Raje <shikhar.r...@dream11.com 
>> <mailto:shikhar.r...@dream11.com>> 写道:
>> 
>> Hello,
>> 
>> I am following along with this tutorial: 
>> https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/try-flink/datastream/
>>  
>> <https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/try-flink/datastream/>
>>  .
>> 
>> I am deploying this to the latest binary downloaded from: 
>> https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/try-flink/local_installation/
>>  
>> <https://nightlies.apache.org/flink/flink-docs-release-2.0/docs/try-flink/local_installation/>
>>  , which is the 2.0.0 binary.
>> 
>> When running the Fraud Detection code, I am getting this error:
>> 
>> Caused by: java.lang.IllegalStateException: Current operator integrates the 
>> async processing logic, thus only supports state v2 APIs. Please use 
>> StateDescriptor under 'org.apache.flink.runtime.state.v2'.
>> 
>> So, two questions about this error message.
>> 1. Following along with the code, it's not clear to me which part of the 
>> operator is using async . If it's possible to mix v2 and v1 APIs in 
>> synchronous mode, that would also work.
>> 2. Looking at the Javadocs for 'org.apache.flink.runtime.state.v2', I can't 
>> seem to see a StateDescriptor class there: 
>> https://javadoc.io/doc/org.apache.flink/flink-runtime/2.0.0/org/apache/flink/runtime/state/v2/package-summary.html
>>  
>> <https://javadoc.io/doc/org.apache.flink/flink-runtime/2.0.0/org/apache/flink/runtime/state/v2/package-summary.html>
>>  . So I'm not sure what is the correct import to use here?
>> 
>> Appreciate any help in this matter!
>> 
>> Thank You
>> 
>> Sincerely,
>> Shikhar Raje
>> 
>> Disclaimer: This message and its attachments contain confidential and 
>> legally privileged information. Dream Sports Group, including all its 
>> affiliates and subsidiaries, provides no warranties with respect to the 
>> contents of this communication and disclaims any and all liability for 
>> reliance thereon.
> 
> 
> Disclaimer: This message and its attachments contain confidential and legally 
> privileged information. Dream Sports Group, including all its affiliates and 
> subsidiaries, provides no warranties with respect to the contents of this 
> communication and disclaims any and all liability for reliance thereon.

Reply via email to