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

Yi Tang edited comment on FLINK-22275 at 4/15/21, 3:22 AM:
-----------------------------------------------------------

Of course.

How about introduce a {{fields.#.max-lag}} integer option with default value as 
{{0}} (expected to nonnegative)? It is obvious that this option can only be 
applied to {{random}} kind and for {{TimestampType}} / {{ZonedTimestampType}} / 
{{LocalZonedTimestampType}} types which all return the current timestamp for 
now.

If one user configured the max-lag, then the generated timestamp will be 
{{currentTimeMillis - random(0, max-lag)}} instead of the original 
{{currentTimeMillis}} only.

For example fields.atime.max-lag = 5000, then the generated timestamp maybe 
consists of (one per second)
|timestamp|1618455622000|1618455623000|1618455624000|1618455625000|
|delta|0|1000|3000|2000|
|generated|1618455622000|1618455622000|1618455621000|1618455623000|


was (Author: yittg):
Of course.

First of all, it is obvious that this option can only be applied to \{{ random 
}} kind.

How about introduce a {{fields.#.max-lag}} integer option with default value as 
{{0}} (expected to nonnegative)? The option can be applied for 
{{TimestampType}} / {{ZonedTimestampType}} / {{LocalZonedTimestampType}} types 
which all return the current timestamp for now.

If one user configured the max-lag, then the generated timestamp will be 
{{currentTimeMillis - random(0, max-lag)}} instead of the original 
{{currentTimeMillis}} only.

For example fields.atime.max-lag = 5000, then the generated timestamp maybe 
consists of (one per second)
|timestamp|1618455622000|1618455623000|1618455624000|1618455625000|
|delta|0|1000|3000|2000|
|generated|1618455622000|1618455622000|1618455621000|1618455623000|

> Datagen add a max lag option for a series of timestamp-related types
> --------------------------------------------------------------------
>
>                 Key: FLINK-22275
>                 URL: https://issues.apache.org/jira/browse/FLINK-22275
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Ecosystem
>            Reporter: Yi Tang
>            Priority: Minor
>
> For now, the {{datagen}} connector always resolves to the current timestamp 
> for timestamp-related types.
> Here proposals to add a max lag option for these types, which will generate a 
> timestamp with a random lag (with max lag as option) compared with the 
> current timestamp. Leave it as before if the option is not configured.



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

Reply via email to