You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2023/06/01 03:44:15 UTC
[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1247: [core] Support to make up the sequence number to nanosecond precision
JingsongLi commented on code in PR #1247:
URL: https://github.com/apache/incubator-paimon/pull/1247#discussion_r1212531896
##########
paimon-core/src/main/java/org/apache/paimon/table/sink/SequenceGenerator.java:
##########
@@ -68,6 +73,32 @@ public long generate(InternalRow row) {
return generator.generate(row, index);
}
+ public long generateWithPadding(InternalRow row, CoreOptions.SequenceAutoPadding autoPadding) {
Review Comment:
I think we can try to finish this in a simpler way:
```
public long generateWithPadding(InternalRow row, CoreOptions.SequenceAutoPadding autoPadding) {
switch (autoPadding) {
case SECOND_TO_MICRO:
long value = generate(row);
// timestamp returns mills
int second = fieldType.is(DataTypeFamily.TIMESTAMP) ? value / 1000 : value;
return secondToMicro(second);
case MILLIS_TO_MICRO:
return millsToMicro(generate(row));
default:
throw new UnsupportedOperationException(
"Unknown sequence padding mode " + autoPadding.name());
}
}
```
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org