xuzhiwen1255 commented on code in PR #21971:
URL: https://github.com/apache/flink/pull/21971#discussion_r1190911094
##########
flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/connector/datagen/table/SequenceGeneratorVisitor.java:
##########
@@ -82,25 +81,11 @@ public SequenceGeneratorVisitor(String name, ReadableConfig
config) {
ConfigOptions.OptionBuilder startKey = key(startKeyStr);
ConfigOptions.OptionBuilder endKey = key(endKeyStr);
- config.getOptional(startKey.stringType().noDefaultValue())
- .orElseThrow(
- () ->
- new ValidationException(
- "Could not find required property '"
- + startKeyStr
- + "' for sequence
generator."));
- config.getOptional(endKey.stringType().noDefaultValue())
- .orElseThrow(
- () ->
- new ValidationException(
- "Could not find required property '"
- + endKeyStr
- + "' for sequence
generator."));
-
- this.intStart = startKey.intType().noDefaultValue();
- this.intEnd = endKey.intType().noDefaultValue();
- this.longStart = startKey.longType().noDefaultValue();
- this.longEnd = endKey.longType().noDefaultValue();
+ // Under sequence, if end and start are not set, the default value is
used
+ this.intStart = startKey.intType().defaultValue(0);
+ this.intEnd = endKey.intType().defaultValue(Integer.MAX_VALUE);
+ this.longStart = startKey.longType().defaultValue(0L);
+ this.longEnd = endKey.longType().defaultValue((long)
Integer.MAX_VALUE);
Review Comment:
I think it can be adjusted a little smaller, otherwise the initialization
time in sequence mode is too long, of course, if the difference between user
start and end is relatively large, this problem will still exist.
The key is in the sequence mode, what is the appropriate default value for
us to set?
I suggest using 2 to the 20th power. -------- default = 1048576
This value is not too large, it should be applicable in general.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]