WZhuo commented on PR #495:
URL: https://github.com/apache/iceberg-cpp/pull/495#issuecomment-3718496913
```
Types.TimestampType type = Types.TimestampType.withoutZone();
Literal<Long> ts = Literal.of("2017-12-01T10:12:55.038194").to(type);
Literal<Long> pts = Literal.of("1970-01-01T00:00:01.000001").to(type);
Literal<Long> nts = Literal.of("1969-12-31T23:59:59.999999").to(type);
Transform<Long, Integer> years = Transforms.year();
assertThat((int) years.bind(type).apply(ts.value()))
.as("Should produce 2017 - 1970 = 47")
.isEqualTo(47);
assertThat((int) years.bind(type).apply(pts.value()))
.as("Should produce 1970 - 1970 = 0")
.isZero();
assertThat((int) years.bind(type).apply(nts.value()))
.as("Should produce 1969 - 1970 = -1")
.isEqualTo(-1);
```
Above is the YearTransform's test case, it should return delta years between
the time and 1970.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]