You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Aljoscha Krettek (Jira)" <ji...@apache.org> on 2020/08/24 12:42:00 UTC

[jira] [Commented] (FLINK-18909) SequenceGenerator doesn't work as expected

    [ https://issues.apache.org/jira/browse/FLINK-18909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183221#comment-17183221 ] 

Aljoscha Krettek commented on FLINK-18909:
------------------------------------------

[~lzljs3620320] Could you please take a look?

> SequenceGenerator doesn't work as expected
> ------------------------------------------
>
>                 Key: FLINK-18909
>                 URL: https://issues.apache.org/jira/browse/FLINK-18909
>             Project: Flink
>          Issue Type: Bug
>          Components: API / DataStream
>    Affects Versions: 1.11.1
>            Reporter: Alan
>            Priority: Minor
>
> When using a org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator
> with 0 and Long.MaxValue the following exception is rasied:
> <<snip>>
> new SequenceGenerator(0, Long.MAX_VALUE);
>  
> Caused by: java.lang.IllegalArgumentExceptionCaused by: java.lang.IllegalArgumentException at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:123) at org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator.safeDivide(SequenceGenerator.java:110) at org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator.open(SequenceGenerator.java:83) at org.apache.flink.streaming.api.functions.source.datagen.DataGeneratorSource.initializeState(DataGeneratorSource.java:64)
>  
> This is because the Long overflows. in the check: 
> long totalNoOfElements = Math.abs(end - start + 1);
> Which is incorrect. - this code should use BigInteger.  
>  
> Using
> new SequenceGenerator(0, Long.MAX_VALUE-1);
> Still fails on the following check:
> Caused by: java.lang.IllegalArgumentExceptionCaused by: java.lang.IllegalArgumentException at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:123) at org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator.safeDivide(SequenceGenerator.java:111) at org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator.open(SequenceGenerator.java:83) at org.apache.flink.streaming.api.functions.source.datagen.DataGeneratorSource.initializeState(DataGeneratorSource.java:64)
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)