DBZ-7107 Fix SerdeTest failure

This commit is contained in:
Chris Cranford 2024-02-14 11:07:23 -05:00 committed by Jiri Pechanec
parent cac38fc484
commit 659fc8df4e
2 changed files with 17 additions and 5 deletions

View File

@ -247,7 +247,7 @@ public Struct read(Object record, Struct source, Instant timestamp) {
if (timestamp != null) {
struct.put(FieldName.TIMESTAMP, timestamp.toEpochMilli());
struct.put(FieldName.TIMESTAMP_US, (timestamp.getEpochSecond() * 1_000_000) + (timestamp.getNano() / 1_000));
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000) + timestamp.getNano());
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000_000L) + timestamp.getNano());
}
return struct;
}
@ -270,7 +270,7 @@ public Struct create(Object record, Struct source, Instant timestamp) {
if (timestamp != null) {
struct.put(FieldName.TIMESTAMP, timestamp.toEpochMilli());
struct.put(FieldName.TIMESTAMP_US, (timestamp.getEpochSecond() * 1_000_000) + (timestamp.getNano() / 1_000));
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000) + timestamp.getNano());
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000_000L) + timestamp.getNano());
}
return struct;
}
@ -297,7 +297,7 @@ public Struct update(Object before, Struct after, Struct source, Instant timesta
if (timestamp != null) {
struct.put(FieldName.TIMESTAMP, timestamp.toEpochMilli());
struct.put(FieldName.TIMESTAMP_US, (timestamp.getEpochSecond() * 1_000_000) + (timestamp.getNano() / 1_000));
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000) + timestamp.getNano());
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000_000L) + timestamp.getNano());
}
return struct;
}
@ -322,7 +322,7 @@ public Struct delete(Object before, Struct source, Instant timestamp) {
if (timestamp != null) {
struct.put(FieldName.TIMESTAMP, timestamp.toEpochMilli());
struct.put(FieldName.TIMESTAMP_US, (timestamp.getEpochSecond() * 1_000_000) + (timestamp.getNano() / 1_000));
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000) + timestamp.getNano());
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000_000L) + timestamp.getNano());
}
return struct;
}
@ -340,7 +340,7 @@ public Struct truncate(Struct source, Instant timestamp) {
struct.put(FieldName.SOURCE, source);
struct.put(FieldName.TIMESTAMP, timestamp.toEpochMilli());
struct.put(FieldName.TIMESTAMP_US, (timestamp.getEpochSecond() * 1_000_000) + (timestamp.getNano() / 1_000));
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000) + timestamp.getNano());
struct.put(FieldName.TIMESTAMP_NS, (timestamp.getEpochSecond() * 1_000_000_000L) + timestamp.getNano());
return struct;
}

View File

@ -146,6 +146,16 @@
"type": "int64",
"optional": true,
"field": "ts_ms"
},
{
"type": "int64",
"optional": true,
"field": "ts_us"
},
{
"type": "int64",
"optional": true,
"field": "ts_ns"
}
],
"optional": false,
@ -154,6 +164,8 @@
"payload": {
"op": "c",
"ts_ms": 1465491411815,
"ts_us": 1465491411815000,
"ts_ns": 1465491411815000000,
"before": null,
"after": {
"id": 1004,