You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Alan (Jira)" <ji...@apache.org> on 2020/08/12 17:11:00 UTC
[jira] [Created] (FLINK-18909) SequenceGenerator doesn't work as
expected
Alan created FLINK-18909:
----------------------------
Summary: 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
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)